Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for color literals #2503

Merged
merged 5 commits into from
Feb 6, 2025
Merged

Add support for color literals #2503

merged 5 commits into from
Feb 6, 2025

Conversation

nex3
Copy link
Contributor

@nex3 nex3 commented Jan 30, 2025

No description provided.

@nex3 nex3 requested a review from Goodwine January 30, 2025 23:28
pkg/sass-parser/lib/src/expression/color.test.ts Outdated Show resolved Hide resolved
pkg/sass-parser/lib/src/expression/color.test.ts Outdated Show resolved Hide resolved
{
"inputs": [
{
"css": "@#{#00f}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it intended for @ to be here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, because we didn't have variable statements early on the way we parse expressions is by creating an interpolation in an unknown at-rule.

pkg/sass-parser/lib/src/expression/color.ts Outdated Show resolved Hide resolved
declare raws: ColorExpressionRaws;

/**
* The color represented by this expression. This will always be a color in
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why will it always be an RGB color? It doesn't seem like it's a limitation on sass_api 🤔

Is this a temporary limitation?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because Sass has no literal syntactic representation of non-RGB colors. Every other color type is returned by function calls.

Co-authored-by: Carlos (Goodwine) <[email protected]>
@nex3 nex3 merged commit 879f484 into main Feb 6, 2025
39 checks passed
@nex3 nex3 deleted the color branch February 6, 2025 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants