Repository navigation
Recognize ASCII case-insensitive color function names - #579
Open
Pradeep Ramola (pradeep-ramola) wants to merge 1 commit into
Open
Pradeep Ramola (pradeep-ramola) wants to merge 1 commit into
Pradeep Ramola (pradeep-ramola) wants to merge 1 commit into
Conversation
This was referenced Nov 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Valid uppercase and mixed-case CSS color functions are not reported by
findDocumentColors. For example,.test { color: RGB(34, 89, 234); }returns no colors, while the lowercase spelling works.Function identifiers retain their source casing in the AST, but
getColorValuecompares the name against lowercase strings. The case-insensitive constructor detection therefore disagrees with actual color extraction.CSS function names are ASCII case-insensitive: https://www.w3.org/TR/css-values-4/#functional-notation
Change
Normalize ASCII uppercase letters in the local function name before dispatching to color conversion. Keep the AST and source ranges unchanged. This also ensures uppercase
COLOR()takes the dedicated color-space/alpha path.The ASCII-only normalization intentionally does not fold the Unicode Kelvin-sign lookalike in
o\u212Alabintooklab.Tests
Added 33 public language-service tests across CSS, LESS, and SCSS:
Before the production fix: 30 failed, 3 controls passed.
Verification on Windows after a clean
npm ci:npm run compile: TypeScript compilation and 7 lint checks passed.node --enable-source-maps --test: 455 passed, no failures/skips.git diff --check: passed.The compiled files were enumerated explicitly because the npm test script's single-quoted glob does not reliably select tests in this Windows shell. Full VS Code color-decorator UI integration was not run.
AI assistance was used to investigate, implement, test, and draft this contribution.