Skip to content

Commit cbcdcf1

Browse files
committed
[css-fonts-4] Add Roel's font palette example #w3c#1103
1 parent e651c00 commit cbcdcf1

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

css-fonts-4/Overview.bs

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6327,6 +6327,49 @@ User-defined font color palettes: The ''@font-palette-values'' rule</h3>
63276327
Each of these palettes are applied
63286328
to each @font-face that share a family name.
63296329

6330+
<div class="example">
6331+
I want to use two color fonts in a greenish palette.
6332+
The first font, Bixxxa, already has palette that I can use,
6333+
but for Bungeehee I need to overwrite one color
6334+
to get my green palette.
6335+
6336+
<pre class="lang-css">
6337+
@font-face {
6338+
font-family: Bixxxa;
6339+
src: url('./bixxxa.woff') format('woff');
6340+
}
6341+
6342+
@font-face {
6343+
font-family: Bungeehee;
6344+
src: url('./bungeehee.woff') format('woff');
6345+
}
6346+
6347+
@font-palette-values ToxicGreen {
6348+
font-family: Bixxxa;
6349+
base-palette: 3; /* This is Bixxxa's green palette */
6350+
}
6351+
6352+
6353+
@font-palette-values ToxicGreen {
6354+
font-family: Bungeehee;
6355+
base-palette: 7; /* This is Bungeehee's green palette... */
6356+
2: lime; /* ...except this is pink, which I overwrite to lime */
6357+
}
6358+
6359+
h1 {
6360+
font-family: Bixxxa;
6361+
font-palette: ToxicGreen;
6362+
}
6363+
6364+
h2 {
6365+
font-family: Bungeehee;
6366+
font-palette: ToxicGreen;
6367+
}
6368+
</pre>
6369+
6370+
<em>Example by Roel Nieskens</em>
6371+
</div>
6372+
63306373
Note: In the case where a family name is shared
63316374
between multiple physical fonts,
63326375
(such as when a compound font is created, using `unicode-range`),
@@ -6337,6 +6380,24 @@ User-defined font color palettes: The ''@font-palette-values'' rule</h3>
63376380
In this case,
63386381
it is better to supply a complete palette definition.
63396382

6383+
<div class="example">
6384+
In the above example,
6385+
since two different font families have been set up
6386+
to have compatible named palettes,
6387+
one could go on to write
6388+
6389+
<pre class="lang-css">
6390+
h3 {
6391+
font-family: Bixxxa, Bungeehee;
6392+
font-palette: ToxicGreen;
6393+
}
6394+
</pre>
6395+
6396+
Which would correctly apply the desired palette
6397+
in each font
6398+
even though they have different palette numbers.
6399+
</div>
6400+
63406401
A given set of ''@font-palette-values'' rules
63416402
define which author-defined palettes are available for use
63426403
within the documents that contain these rules.

0 commit comments

Comments
 (0)