« Couleurs CSS » : différence entre les versions
m (→HTML/CSS) |
m (→HTML/CSS) |
||
| (13 versions intermédiaires par le même utilisateur non affichées) | |||
| Ligne 180 : | Ligne 180 : | ||
</div> | </div> | ||
== En X11 R6 == | |||
Le mécanisme de X Windows, le gestionnaire de fenêtre historique sous Unix qui marche encore sous Linux avait déjà normalisé les couleurs. Le W3C a repris ces couleurs mais en a changé... 4. | |||
Pourquoi 4? Je ne sais pas. | |||
<div style="text-align: center"> | |||
<div style="width: 600px; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Nom</div> | |||
<div style="flex: 1; background-color: White;">Couleur CSS</div> | |||
<div style="flex: 1; background-color: white;">Hexa CSS</div> | |||
<div style="flex: 1; background-color: white;">Couleur X11</div> | |||
<div style="flex: 1; background-color: white;">Hexa X11</div> | |||
</div> | |||
<div style="width: 600px; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Gray</div> | |||
<div style="flex: 1; background-color: gray;"> </div> | |||
<div style="flex: 1; background-color: white;">#808080</div> | |||
<div style="flex: 1; background-color: #BEBEBE;"> </div> | |||
<div style="flex: 1; background-color: white;">#BEBEBE</div> | |||
</div> | |||
<div style="width: 600px; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Green</div> | |||
<div style="flex: 1; background-color: green;"> </div> | |||
<div style="flex: 1; background-color: white;">#008000</div> | |||
<div style="flex: 1; background-color: #00FF00;"> </div> | |||
<div style="flex: 1; background-color: white;">#00FF00</div> | |||
</div> | |||
<div style="width: 600px; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Maroon</div> | |||
<div style="flex: 1; background-color: maroon;"> </div> | |||
<div style="flex: 1; background-color: white;">#800000</div> | |||
<div style="flex: 1; background-color: #B03060;"> </div> | |||
<div style="flex: 1; background-color: white;">#B03060</div> | |||
</div> | |||
<div style="width: 600px; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Purple</div> | |||
<div style="flex: 1; background-color: purple;"> </div> | |||
<div style="flex: 1; background-color: white;">#800080</div> | |||
<div style="flex: 1; background-color: #A020F0;"> </div> | |||
<div style="flex: 1; background-color: white;">#A020F0</div> | |||
</div> | |||
</div>X11 ils aiment bien les couleurs qui pêtent. | |||
== Exemples == | == Exemples == | ||
=== HTML/CSS === | === HTML/CSS === | ||
<div style="width: 100%; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"><div style="flex: 1; background-color: white;"> | |||
<div style="width: 100%; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"><div style="flex: 1; background-color: white;"> | Pour afficher le tableau suivant en HTML | ||
<div style="width: 100%; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Fond blanc</div> | |||
<div style="flex: 1; background-color:olivedrab;">olivedrab</div> | |||
</div> | |||
Il faut utiliser le code | |||
<syntaxhighlight lang="html"> | |||
<div style="width: 100%; display: flex; border: 1px solid #ccc; margin-bottom: 10px;"> | |||
<div style="flex: 1; background-color: white;">Fond blanc</div> | |||
<div style="flex: 1; background-color:olivedrab;">olivedrab</div> | |||
</div> | |||
</syntaxhighlight> | </syntaxhighlight> | ||
=== Microsoft === | |||
Il y a une boite, fournie par Windows, de sélection des couleurs. La boite de dialogue suivante sert a choisir la couleur. | |||
[[Fichier:Color-selector.png|sans_cadre]] | |||
Dans la case Hex on lace le code dans la deuxième colonne du tableau ci dessus. Les cases Rouges, vert et bleu contiennent, elle, ce qu'il y a dans la troisième colonne. | |||
C'est utile quand on code.... | |||
Version actuelle datée du 27 novembre 2025 à 09:24
Les couleurs peuvent êtres décrites dans beaucoup de palettes différentes, certaines ont des noms mais on peut aussi les décrire dans des systèmes colorimétriques. (RGB, RGAa, CMYB... PANTONE).
Certaines couleurs ont été très tôt nommées. Des 1986 on a une première normalisation avec X Windows. https://en.wikipedia.org/wiki/X11_color_names. Puis c'est le W3C qui a repris le flambeau de la normalisation en reprenant quasi mot pour mot les noms de couleurs X11.
En 1996 les couleurs de bases ont été reprises par le W3C puis revues plusieurs fois. La dernière version, à l'heure où j'écris ces lignes, date de 2022 mais n'à quasiment pas bougé depuis 2008.
Ce codage de couleurs est devenu un standard que l'on peut utiliser :
- En html/css qui est sa destination première
- En X11 R6 qui en est à l'origine
- Avec la librairie python mathplotlib.
- et bien d'autres encores
Les couleurs de bases
Les couleurs étendues
En X11 R6
Le mécanisme de X Windows, le gestionnaire de fenêtre historique sous Unix qui marche encore sous Linux avait déjà normalisé les couleurs. Le W3C a repris ces couleurs mais en a changé... 4.
Pourquoi 4? Je ne sais pas.
X11 ils aiment bien les couleurs qui pêtent.
Exemples
HTML/CSS
Pour afficher le tableau suivant en HTML
Il faut utiliser le code
<div style="width: 100%; display: flex; border: 1px solid #ccc; margin-bottom: 10px;">
<div style="flex: 1; background-color: white;">Fond blanc</div>
<div style="flex: 1; background-color:olivedrab;">olivedrab</div>
</div>
Microsoft
Il y a une boite, fournie par Windows, de sélection des couleurs. La boite de dialogue suivante sert a choisir la couleur.
Dans la case Hex on lace le code dans la deuxième colonne du tableau ci dessus. Les cases Rouges, vert et bleu contiennent, elle, ce qu'il y a dans la troisième colonne.
C'est utile quand on code....