Skip to content

Support for oklab and oklch color functions INSIDE DIRECTIVES #453

Open

Description

@leandro-hl

Example

Image

VS Code data data
Version: 1.103.0
Commit: e3550cfac4b63ca4eafca7b601f0d2885817fd1f
Date: 2025-08-06T21:40:10.271Z
Electron: 37.2.3
ElectronBuildId: 12035395
Chromium: 138.0.7204.100
Node.js: 22.17.0
V8: 13.8.500258-electron.0
OS: Linux x64 6.11.0-1018-azure

Activity

  1. kakiuwang-ui commented on Sep 16, 2026

    @kakiuwang-ui
    Contributor

    I looked into this. The screenshot is the case to reproduce: oklch() colors inside an unknown at-rule block. Colors inside known at-rules like @media or @supports already get decorators.

    @plugin "daisyui/theme" {
      name: "dark";
      --color-base-100: oklch(16.8% 0% 0);   /* no color decorator */
    }

    This reproduces with 6.3.10 and 7.0.0-next.2. The cause isn't the color code. _parseUnknownAtRule only balances brackets until the block ends, so the whole body of an unknown at-rule becomes one UnknownAtRule node with no children except its name. findDocumentColors has nothing to visit. The same thing explains #423: no completion or hover inside custom directive blocks.

    I'd be happy to work on it, but it's a design choice, so I wanted to check first which direction you'd prefer:

    1. Parse the block of an unknown at-rule as declarations and nested rules, falling back to the current token skipping if that fails. This fixes colors for every unknown at-rule (Tailwind's @theme, @utility, daisyUI's @plugin, …), but changes how all unknown at-rules are parsed.
    2. Only for at-rules declared through custom data, e.g. an opt-in flag on the directive's entry. That's narrower and stays predictable, but it wouldn't help users who haven't configured custom data.

    Note that #523 is also changing _parseUnknownAtRule right now, so I'd wait for it to land either way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions