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 function to get hsl values #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

atpriyanshu
Copy link
Contributor

@atpriyanshu atpriyanshu commented Jun 25, 2022

Hi @KittyGiraudel!
I have updated _functions.scss to add get-hsl-values function.

Update _functions.scss to add `get-hsl-values` function
@atpriyanshu
Copy link
Contributor Author

atpriyanshu commented Jun 25, 2022

Some common use cases:

$clr-primary-base: #56ffff;

body {
  background: hsl(get-hsl-values($clr-primary-base) / 0.2);
}
// _variables.scss
$theme: (
  primary: (
    300: hsl(199 100% 65%),
    base: hsl(199 100% 50%),
    500: hsl(199 100% 45%),
  ),
  secondary: (
    300: hsl(32 100% 65%),
    base: hsl(32 100% 50%),
    500: hsl(32 100% 45%),
  ),
  accent: (
    300: hsl(0 0% 35%),
    base: hsl(0 0% 24%),
    500: hsl(0 0% 16%),
  ),
);

// _root.scss
:root {

  // colors
  @each $type, $shades in $theme {
    @each $key, $value in $shades {
      --clr-#{$type}-#{$key}: #{$value};
      --clr-#{$type}-#{$key}-hsl: #{get-hsl-values($value)};
    }
  }

}

@atpriyanshu
Copy link
Contributor Author

May you review and feedback me?

@atpriyanshu atpriyanshu changed the title Update _functions.scss Add function to get hsl values Jul 20, 2022
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.

None yet

1 participant