SUI-Components / sui-components

SUI Components
https://sui-components.vercel.app/
MIT License
140 stars 59 forks source link

sui-theme v9 custom-properties available #2754

Open andresin87 opened 2 months ago

andresin87 commented 2 months ago

Css native custom properties

🔍 Show

TASK:

Description, Motivation and Context

This PR is using @s-ui/theme@9.0.0-beta-2 which is a proposal to get ready to use css native custom tokens in brand web-apps and brand themes.

Those theme changes can be inspected in https://github.com/SUI-Components/sui/pull/1804

The main handicap is the usage of SASS color functions and css rgba color standard.

 Replacing errors

When experiencing any problem related to this, the solution is color-mix CSS native color manipulation syntax. EX:

[!IMPORTANT] color-mix Browser Compatibility

whatever {
 background-color: rgba(0,0,0,.3)
}

can be replaced to

whatever {
 background-color: color-mix(in srgb, black 70%, transparent)
}

also, for scss native color manipulation functions

whatever {
 background-color: mix($white, $color-primary, $mix-factor);
}

can be replaced to

whatever {
 background-color: color-mix(in srgb, $white #{'#{$mix-factor)}%'}, $color-primary);
}

Other utils

color-mix allows to nest its inner values

whatever {
  background-color: color-mix(in srgb, color-mix(in srgb, red 50%, yellow) 30%, blue)
}

Types of changes

Screenshots - Animations

turolopezsanabria commented 2 months ago

🤩

github-actions[bot] commented 1 month ago
STATEMENTS BRANCHES FUNCTIONS LINES
≍ 0= ≍ 0= ≍ 0= ≍ 0=
% 75.9 64.19 65.99 77.7
ABS 3343 / 4404 2051 / 3195 654 / 991 3164 / 4072
github-actions[bot] commented 1 month ago
STATEMENTS BRANCHES FUNCTIONS LINES
≍ 0= ≍ 0= ≍ 0= ≍ 0=
% 75.9 64.19 65.99 77.7
ABS 3343 / 4404 2051 / 3195 654 / 991 3164 / 4072