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

[#15] Built-in color manipulation functions #42

Merged
merged 1 commit into from
Dec 22, 2024

Conversation

dmtrshat
Copy link
Member

These changes enable advanced color manipulation and improve extensibility for future color-related features.


Introduced a standalone color core module for parsing and manipulating colors.

This module provides color parsing and manipulation strictly following the CSS Color Module Level 4 specification. Unlike SASS, which sometimes deviates or extends CSS behaviors, this module implements color functions and parsing rules in accordance with the standard CSS spec,
ensuring predictable and interoperable color handling for web-oriented applications.

Overview

  • Color struct: Represents an RGBA color with optional transparency.
  • Named colors: Predefined according to the CSS spec (e.g., "red", "blue").
  • CSS-like parsing: Supports hex codes, rgb()/hsl()/hwb() notations, etc.
  • Color transformations: grayscale(), lighten(), darken(), etc. (modeled after CSS, not SASS).

Examples

use grimoire_css_lib::core::Color;
let c = Color::try_from_str("rgb(255, 0, 0)").unwrap(); // strictly CSS parsing

Added a Grimoire CSS-specific handler module for custom color functions.


Closes #15

- Introduced a standalone `color` core module for parsing and manipulating colors.
  This module strictly adheres to the CSS Color Module Level 4 specification, offering higher compliance compared to SASS.
- Added a Grimoire CSS-specific handler module for custom color functions.

These changes enable advanced color manipulation and improve extensibility for future color-related features.
@dmtrshat dmtrshat merged commit 88dd684 into rc/1.2.0 Dec 22, 2024
1 check passed
@dmtrshat dmtrshat deleted the feature/#15_built-in-color-functions branch December 22, 2024 15:12
@dmtrshat dmtrshat restored the feature/#15_built-in-color-functions branch December 22, 2024 15:12
@dmtrshat dmtrshat linked an issue Dec 22, 2024 that may be closed by this pull request
@dmtrshat dmtrshat added the enhancement New feature or request label Dec 22, 2024
@dmtrshat dmtrshat self-assigned this Dec 22, 2024
@dmtrshat dmtrshat deleted the feature/#15_built-in-color-functions branch December 22, 2024 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Ready
Development

Successfully merging this pull request may close these issues.

Built-in Color Functions
1 participant