Seenthis
•
 
Identifiants personnels
  • [mot de passe oublié ?]

 

b_b

@b_b
http://blog.eliaz.fr
RSS: b_b
tous les messages de b_b
  • @b_b
    b_b @b_b PUBLIC DOMAIN 22/03/2026
    1
    @rastapopoulos
    1

    #CSS #Relative #Colors: Build UI #Palettes Without a Color Picker
    ▻https://theosoti.com/blog/css-relative-colors

    Relative colors shine when a component needs multiple accents. Here is a compact pattern for a callout card:

    Keep derived tokens in one space so the relationships stay coherent. Mixing spaces is valid, but remember the source is converted to the output space for every calculation, which can subtly change the result.

    The component only needs one input (—tone). Everything else follows.

    .callout {
    	--tone: #4b6bff;
    	--tone-strong: hsl(from var(--tone) h s calc(l - 12));
    	--tone-soft: hsl(from var(--tone) h calc(s - 20) calc(l + 28));
    	--tone-border: rgb(from var(--tone) r g b / 0.2);
    	--tone-shadow: rgb(from var(--tone) r g b / 0.25);
    
    	border: 1px solid var(--tone-border);
    	background-color: var(--tone-soft);
    	box-shadow: 0 12px 24px var(--tone-shadow);
    }
    
    .callout strong {
    	color: var(--tone-strong);
    }

    via ▻https://css-tricks.com/whats-important-6

    b_b @b_b PUBLIC DOMAIN
    • @rastapopoulos
      RastaPopoulos @rastapopoulos CC BY-NC 23/03/2026

      Attention quand même : ▻https://caniuse.com/mdn-css_types_color_hsl_relative_syntax

      93% en France et 89,5% dans le monde, c’est pas 98% ni même 95% comme seuil acceptable de « presque tout le monde ok ».

      RastaPopoulos @rastapopoulos CC BY-NC
    Écrire un commentaire

thèmes

  • #4b6bff
  • #Colors
  • #CSS
  • #Palettes
  • #Relative
Propriété intellectuelle Recommandations API