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

btn-primary background color does not change after primary extended #109

Closed
roonie007 opened this issue Apr 19, 2022 · 5 comments
Closed
Labels
pending release This issue has been looked at and resolved in code. It is now pending the next release.
Projects

Comments

@roonie007
Copy link
Contributor

Describe the bug
After setting up a custom primary color:

@use "cirrus-ui/src/cirrus-ext" as * with (
  $config: (
    extend: (
      colors: (
        semantic: (
          "primary": #1e272e,
        ),
      ),
    ),
  )
);

bg-primary is working as expected but when using btn-primary on button, the background color does not change to the extended color.

@Spiderpig86
Copy link
Owner

For customizing control themes, there is an entry within the configuration called control-themes which is where you can specify which colors are used to generate themed variants for form controls such as check boxes, toggles, etc.

Defaults are set here: https://github.com/Spiderpig86/Cirrus/blob/master/src/internal/_config.scss#L206

Currently it does not support buttons, but I'll add that for 0.7.1.

@Spiderpig86 Spiderpig86 added this to To do in 0.7.1 Apr 21, 2022
@roonie007
Copy link
Contributor Author

@Spiderpig86 perfect, I am currently using a custom made workaround so I will wait for the 0.7.1 :)

@Ponkhy
Copy link

Ponkhy commented May 17, 2022

@Spiderpig86 perfect, I am currently using a custom made workaround so I will wait for the 0.7.1 :)

Hey! May i ask how your workaround looks like? Cause i'm facing the same issue right now.

@roonie007
Copy link
Contributor Author

roonie007 commented May 17, 2022

@Spiderpig86 perfect, I am currently using a custom made workaround so I will wait for the 0.7.1 :)

Hey! May i ask how your workaround looks like? Cause i'm facing the same issue right now.

@Ponkhy, here is it

// I created a Map that contains my brand colors
$u-colors: (
  plain: rgba(var(--btn-fg), var(--color-opacity)),
  'white': white,
  'black': black,
  primary: #1e272e,
  success: #27ae60,
  danger: #e74c3c,
);

// and then I did extend cirrus colors
@use 'cirrus-ui/src/cirrus-ext' as * with (
  $config: (
    extend: (
      colors: (
        semantic: (
          'primary': map.get($u-colors, primary),
          'success': map.get($u-colors, success),
          'danger': map.get($u-colors, danger),
        ),
      ),
    ),
  )
);

// and finally generate the needed classes
@each $name, $color in $u-colors {
  .animated.loading.loading-#{$name}::after {
    border-left-color: $color;
    border-bottom-color: $color;
  }

  .btn-#{$name}:not(.outline) {
    background-color: $color !important;
  }

  .btn-#{$name}.outline:hover {
    background-color: $color !important;
  }

  .btn-#{$name}.outline {
    border-color: $color !important;
  }
}

and here is the result :D in different buttons styles

image

@Ponkhy
Copy link

Ponkhy commented May 17, 2022

Perfect! Thank you very much!

Spiderpig86 added a commit that referenced this issue Jun 30, 2022
…es in control-themes map, new map to represent control-theme values which includes fg and bg colors #109
@Spiderpig86 Spiderpig86 moved this from To do to Done in 0.7.1 Jul 1, 2022
@Spiderpig86 Spiderpig86 added the pending release This issue has been looked at and resolved in code. It is now pending the next release. label Jul 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending release This issue has been looked at and resolved in code. It is now pending the next release.
Projects
0.7.1
  
Done
Development

No branches or pull requests

3 participants