Skip to content

Commit 541519d

Browse files
committed
[css-color] Markup tweak
1 parent 4cbe01e commit 541519d

2 files changed

Lines changed: 96 additions & 96 deletions

File tree

css-color/Overview.bs

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -2483,10 +2483,10 @@ APIs for Parsing and Manipulating Colors</h2>
24832483

24842484
<li>
24852485
It allows colors to be manipulated in any of the syntaxes that CSS exposes:
2486-
<a idl>RGBColor</a> for RGBA colors, with components ranging from 0-1;
2487-
<a idl>HexColor</a> for RGBA colors, with components ranging from 0-255;
2488-
<a idl>HSLColor</a> for HSLA colors, corresponding to the ''hsla()'' syntax;
2489-
and <a idl>CMYKColor</a> for CMYK colors, corresponding to the ''device-cmyk()'' syntax.
2486+
{{RGBColor}} for RGBA colors, with components ranging from 0-1;
2487+
{{HexColor}} for RGBA colors, with components ranging from 0-255;
2488+
{{HSLColor}} for HSLA colors, corresponding to the ''hsla()'' syntax;
2489+
and {{CMYKColor}} for CMYK colors, corresponding to the ''device-cmyk()'' syntax.
24902490

24912491
All of these expose their components as attributes you can manipulate directly,
24922492
and colors can be easily converted between any of the classes with methods like <code>toRGB()</code> and <code>toHSL()</code>.
@@ -2513,13 +2513,13 @@ APIs for Parsing and Manipulating Colors</h2>
25132513
<h3 id='api-RGBColor'>
25142514
The RGBColor Object</h3>
25152515

2516-
The <a idl>RGBColor</a> class is the "primary" color class,
2516+
The {{RGBColor}} class is the "primary" color class,
25172517
because all CSS colors must be RGB-compatible
25182518
(that is, capable of being converted into a roughly equivalent RGB color).
25192519
As a result, it's always possible to convert a UA-defined color class
25202520
(and any properly-designed author-defined color classes,
25212521
see [[#api-extending]])
2522-
into an equivalent <a idl>RGBColor</a> instance.
2522+
into an equivalent {{RGBColor}} instance.
25232523
This fact is used to aid in automatic handling of several methods common to all color classes.
25242524

25252525
<pre class='idl'>
@@ -2588,7 +2588,7 @@ The RGBColor Object</h3>
25882588
not 0 to 255.
25892589
See the <a idl for>HexColor</a> class if you prefer working in the 0-255 range.
25902590

2591-
<dt><dfn constructor title="RGBColor(rgb)">RGBColor</dfn>(<a idl>RGBColor</a> <dfn argument for="RGBColor(rgb)">rgb</dfn>)
2591+
<dt><dfn constructor title="RGBColor(rgb)">RGBColor</dfn>({{RGBColor}} <dfn argument for="RGBColor(rgb)">rgb</dfn>)
25922592
<dd>
25932593
Defined as follows in ECMAScript:
25942594

@@ -2636,7 +2636,7 @@ The RGBColor Object</h3>
26362636
<dd>
26372637
<a>Parse a component value</a> from the passed string.
26382638
If this operation succeeds and the result is a valid CSS color,
2639-
construct an instance of the <a idl>RGBColor</a> class
2639+
construct an instance of the {{RGBColor}} class
26402640
with attributes initialized to represent that color.
26412641

26422642
Otherwise, throw an XXXError.
@@ -2698,7 +2698,7 @@ The RGBColor Object</h3>
26982698
<dt><dfn attribute>b</dfn> <span attribute-info for="RGBColor/b"></span>
26992699
<dt><dfn attribute>a</dfn> <span attribute-info for="RGBColor/a"></span>
27002700
<dd link-for="RGBColor">
2701-
The <a idl>r</a>, <a idl>g</a>, <a idl>b</a>, and <a idl>a</a> attributes
2701+
The {{r}}, {{g}}, {{b}}, and {{a}} attributes
27022702
represent the red, green, blue, and alpha channels of the RGB color
27032703
that the <a idl for>RGBColor</a> instance represents.
27042704

@@ -2864,7 +2864,7 @@ The HSLColor Class</h3>
28642864
<dd>
28652865
<a>Parse a component value</a> from the passed string.
28662866
If this operation succeeds and the result is a valid CSS color,
2867-
construct an instance of the <a idl>HSLColor</a> class
2867+
construct an instance of the {{HSLColor}} class
28682868
with attributes initialized to represent that color.
28692869

28702870
Otherwise, throw an XXXError.
@@ -2910,7 +2910,7 @@ The HSLColor Class</h3>
29102910
<dt><dfn attribute>l</dfn> <span attribute-info for="HSLColor/l"></span>
29112911
<dt><dfn attribute>a</dfn> <span attribute-info for="HSLColor/a"></span>
29122912
<dd link-for="HSLColor">
2913-
The <a idl>h</a>, <a idl>s</a>, <a idl>l</a>, and <a idl>a</a> attributes
2913+
The {{h}}, {{s}}, {{l}}, and {{a}} attributes
29142914
represent the hue, saturation, lightness, and alpha channels of the HSL color
29152915
that the <a idl for>HSLColor</a> instance represents.
29162916

@@ -2984,7 +2984,7 @@ The HexColor Class</h3>
29842984
}
29852985
</pre>
29862986

2987-
<dt><dfn constructor title="HexColor(rgb)">HexColor</dfn>(<a idl>RGBColor</a> <dfn argument for="HexColor/HexColor(rgb)">rgb</dfn>)
2987+
<dt><dfn constructor title="HexColor(rgb)">HexColor</dfn>({{RGBColor}} <dfn argument for="HexColor/HexColor(rgb)">rgb</dfn>)
29882988
<dd>
29892989
Defined as follows in ECMAScript:
29902990

@@ -3049,7 +3049,7 @@ The HexColor Class</h3>
30493049
<dd>
30503050
<a>Parse a component value</a> from the passed string.
30513051
If this operation succeeds and the result is a valid CSS color,
3052-
construct an instance of the <a idl>HexColor</a> class
3052+
construct an instance of the {{HexColor}} class
30533053
with attributes initialized to represent that color.
30543054

30553055
Otherwise, throw an XXXError.
@@ -3069,7 +3069,7 @@ The HexColor Class</h3>
30693069
<dt><dfn attribute>b</dfn> <span attribute-info for="HexColor/b"></span>
30703070
<dt><dfn attribute>a</dfn> <span attribute-info for="HexColor/a"></span>
30713071
<dd link-for="HexColor">
3072-
The <a idl>r</a>, <a idl>g</a>, <a idl>b</a>, and <a idl>a</a> attributes
3072+
The {{r}}, {{g}}, {{b}}, and {{a}} attributes
30733073
represent the red, blue, green, and alpha channels of the RGB color
30743074
that the <a idl for>HexColor</a> instance represents.
30753075

@@ -3148,7 +3148,7 @@ The CMYKColor Class</h3>
31483148
}
31493149
</pre>
31503150

3151-
<dt><dfn constructor title="CMYKColor(rgb)">CMYKColor</dfn>(<a idl>RGBColor</a> <dfn argument for="CMYKColor/CMYKColor(rgb)">rgb</dfn>)
3151+
<dt><dfn constructor title="CMYKColor(rgb)">CMYKColor</dfn>({{RGBColor}} <dfn argument for="CMYKColor/CMYKColor(rgb)">rgb</dfn>)
31523152
<dd>
31533153
Defined as follows in ECMAScript:
31543154

@@ -3229,11 +3229,11 @@ The CMYKColor Class</h3>
32293229
<dd>
32303230
<a>Parse a component value</a> from the passed string.
32313231
If this operation succeeds and the result is a valid ''device-cmyk()'' function,
3232-
construct an instance of the <a idl>CMYKColor</a> class
3232+
construct an instance of the {{CMYKColor}} class
32333233
with attributes initialized to represent that color.
32343234

32353235
Otherwise, if the operation succeeds and the result is any other type of valid CSS color,
3236-
construct an instance of the <a idl>CMYKColor</a> class
3236+
construct an instance of the {{CMYKColor}} class
32373237
with attributes initialized to represent that color
32383238
converted to CMYK,
32393239
per [[#cmyk-rgb]].
@@ -3261,7 +3261,7 @@ The CMYKColor Class</h3>
32613261
<dt><dfn attribute>a</dfn> <span attribute-info for="CMYKColor/a"></span>
32623262
<dt><dfn attribute>fallback</dfn> <span attribute-info for="CMYKColor/fallback"></span>
32633263
<dd link-for="CMYKColor">
3264-
The <a idl>c</a>, <a idl>m</a>, <a idl>y</a>, <a idl>k</a>, <a idl>a</a>, and <a idl>fallback</a> attributes
3264+
The {{c}}, {{m}}, {{y}}, {{k}}, {{a}}, and {{fallback}} attributes
32653265
represent the red, blue, green, and alpha channels of the CMYK color
32663266
that the <a idl for>CMYKColor</a> instance represents.
32673267

@@ -3320,8 +3320,8 @@ Adding New Color-Manipulating Methods</h4>
33203320

33213321
<ol>
33223322
<li>
3323-
Define the method for <a idl>RGBColor</a>s,
3324-
by adding it to <code><a idl>RGBColor</a>.prototype</code>.
3323+
Define the method for {{RGBColor}}s,
3324+
by adding it to <code>{{RGBColor}}.prototype</code>.
33253325

33263326
<li>
33273327
Define a forwarding method for all other color classes,
@@ -3363,7 +3363,7 @@ Adding New Color-Manipulating Methods</h4>
33633363
Without any further effort,
33643364
the <code>lightness()</code> method
33653365
is now available for other color classes,
3366-
like instances of <a idl>CMYKColor</a>.
3366+
like instances of {{CMYKColor}}.
33673367
</div>
33683368

33693369
<h4 id='api-adding-classes'>
@@ -3374,7 +3374,7 @@ Adding New Color Classes</h4>
33743374
For example,
33753375
even though HSL colors are conceptually equivalent to RGB colors,
33763376
it is still sometimes useful to be able to directly alter the hue angle of the color,
3377-
which the <a idl>HSLColor</a> class allows.
3377+
which the {{HSLColor}} class allows.
33783378

33793379
If, as an author, you wish to work with colors in your application in a color space that CSS does not directly support,
33803380
you can easily add your own color class.
@@ -3386,22 +3386,22 @@ Adding New Color Classes</h4>
33863386

33873387
<ol>
33883388
<li>
3389-
Subclass <a idl>CSSColor</a>,
3389+
Subclass {{CSSColor}},
33903390
such as via:
33913391

33923392
<pre>MyNewColor.prototype = Object.create(CSSColor.prototype);</pre>
33933393

33943394
<li>
33953395
Implement a <code>toRGB()</code> method,
33963396
which can be called without any arguments
3397-
and which returns an equivalent <a idl>RGBColor</a> instance.
3398-
(Remember that the normal range of <a idl>RGBColor</a> components
3397+
and which returns an equivalent {{RGBColor}} instance.
3398+
(Remember that the normal range of {{RGBColor}} components
33993399
is between 0 and 1, not 0 and 255.)
34003400

34013401
<li>
34023402
Implement a constructor that,
3403-
when passed an <a idl>RGBColor</a> instance as its sole argument,
3404-
will produce a color equivalent to the <a idl>RGBColor</a>.
3403+
when passed an {{RGBColor}} instance as its sole argument,
3404+
will produce a color equivalent to the {{RGBColor}}.
34053405
(Same disclaimer as previous item.)
34063406
</ol>
34073407

@@ -3504,21 +3504,21 @@ Adding New Color Classes</h4>
35043504
and turn it into an instance of your class.
35053505

35063506
<li>
3507-
A <code>toMyColor()</code> method on <code><a idl>RGBColor</a>.prototype</code>,
3507+
A <code>toMyColor()</code> method on <code>{{RGBColor}}.prototype</code>,
35083508
that transforms any type of color into your color class.
35093509

35103510
<li>
35113511
If your class is very similar to an existing class,
35123512
such that you can do a better/faster conversion between the existing class and yours directly
3513-
rather than doing through <a idl>RGBColor</a> first,
3513+
rather than doing through {{RGBColor}} first,
35143514
an <code>toMyColor()</code> method on <code>TheOtherColor.prototype</code>,
35153515
and a <code>toTheOtherColor()</code> method on <code>MyNewColor.prototype</code>.
35163516
Add cases to your constructor to handle these classes as well.
35173517

35183518
<li>
35193519
Custom stringifiers on the <code>stringifiers</code> object for one of the UA-defined color classes,
35203520
if it's more accurate/efficient to convert your color class into one of the UA-defined types directly
3521-
than it is to first convert it into an <a idl>RGBColor</a>.
3521+
than it is to first convert it into an {{RGBColor}}.
35223522

35233523
Note: It is <strong>not</strong> generally useful to define a special stringifier for your class itself;
35243524
the main purpose of the stringifier is to allow the object to be used in a CSS property,
@@ -3678,29 +3678,29 @@ The CSSColor Object</h3>
36783678

36793679
In addition,
36803680
it provides two static methods:
3681-
<a idl>parse()</a>,
3681+
{{parse()}},
36823682
which takes a string containing a CSS color value
36833683
and returns an appropriate color class
36843684
representing that value;
3685-
and <a idl>forward()</a>,
3685+
and {{forward()}},
36863686
which is a helper function for adding new methods to all color classes
36873687
(see [[#api-adding-methods]] for more detail on using this function).
36883688

36893689
<div class='example'>
36903690
The most common use of this interface is to parse color strings into an appropriate color object.
36913691

3692-
The following code sets <code>color</code> to a <a idl>HexColor</a> object:
3692+
The following code sets <code>color</code> to a {{HexColor}} object:
36933693

36943694
<pre>var color = CSSColor.parse("#96c");</pre>
36953695

3696-
While this code sets <code>color</code> to an <a idl>HSLColor</a> object:
3696+
While this code sets <code>color</code> to an {{HSLColor}} object:
36973697

36983698
<pre>var color = CSSColor.parse("hsl(120deg, 100%, 50%)");</pre>
36993699

37003700
Note that this returns a color class matching the type of input provided to it.
37013701
If a particular color class is desired,
37023702
the class's constructor can be passed a string instead.
3703-
For example, the following will set <code>color</code> to an <a idl>RGBColor</a> object,
3703+
For example, the following will set <code>color</code> to an {{RGBColor}} object,
37043704
even though it uses the ''hsl()'' function:
37053705

37063706
<pre>var color = new RGBColor("hsl(120deg, 100%, 50%)")</pre>
@@ -3738,7 +3738,7 @@ The CSSColor Object</h3>
37383738
<dd>
37393739
Throw an XXXError.
37403740

3741-
Note: All <a idl>CSSColor</a> subclasses have to implement this method themselves.
3741+
Note: All {{CSSColor}} subclasses have to implement this method themselves.
37423742

37433743
<dt><dfn method title="parse()">parse</dfn>(
37443744
DOMString <dfn argument for="CSSColor/parse()">css</dfn>,
@@ -3753,7 +3753,7 @@ The CSSColor Object</h3>
37533753
Throws if it can't parse a color out of the string,
37543754
or if you give it "currentcolor" but no element to resolve against.
37553755

3756-
<dt><dfn method title="toString()">toString</dfn>(optional <a idl>ColorStringifierType</a> <dfn argument for="CSSColor/toString()">type</dfn>, any... args)
3756+
<dt><dfn method title="toString()">toString</dfn>(optional {{ColorStringifierType}} <dfn argument for="CSSColor/toString()">type</dfn>, any... args)
37573757
<dd>
37583758
Defined as follows in ECMAScript:
37593759

@@ -3769,7 +3769,7 @@ The CSSColor Object</h3>
37693769
type = "rgb";
37703770
}
37713771

3772-
if(/* <var>type</var> is not a <a idl>ColorStringifierType</a> value */) {
3772+
if(/* <var>type</var> is not a {{ColorStringifierType}} value */) {
37733773
throw XXXError("Invalid stringifier type: " + type);
37743774
}
37753775

@@ -3787,10 +3787,10 @@ The CSSColor Object</h3>
37873787
This function automates "forwarding" methods to a canonical definition in RGBColor,
37883788
so that authors can add new methods to color objects
37893789
without having to explicitly add variants of the method to every single color class.
3790-
It adds a default version of a method to <code><a idl>CSSColor</a>.prototype</code>
3790+
It adds a default version of a method to <code>{{CSSColor}}.prototype</code>
37913791
(which will get picked up by all subclasses,
37923792
unless explicitly overridden)
3793-
that converts the color into an <a idl>RGBColor</a>
3793+
that converts the color into an {{RGBColor}}
37943794
and calls the method there.
37953795

37963796
Note: For this to work correctly,
@@ -3813,25 +3813,25 @@ The CSSColor Object</h3>
38133813

38143814
<dt><dfn method title="forwardToSameClass()">forwardToSameClass</dfn>(<dfn argument for="CSSColor/forwardToSameClass()">methodName</dfn>)
38153815
<dd>
3816-
Similar to the <a idl>forward()</a> method,
3816+
Similar to the {{forward()}} method,
38173817
but used when the method returns a color object,
38183818
and you'd like it to return the same type of color object as you called the method on.
38193819

38203820
<div class='example'>
3821-
It is always safe to use <a idl>forward()</a> on a method;
3821+
It is always safe to use {{forward()}} on a method;
38223822
if it returns a color,
38233823
it will just be an RGBColor.
38243824
For example, if you use <code>CSSColor.forward("lighten");</code>
38253825
to forward a <code>lighten(%)</code> method to all color types,
3826-
when you call <code>c.lighten(.2)</code> on an <a idl>HSLColor</a> object,
3827-
you'll get back the lightened color as an <a idl>RGBColor</a> object.
3826+
when you call <code>c.lighten(.2)</code> on an {{HSLColor}} object,
3827+
you'll get back the lightened color as an {{RGBColor}} object.
38283828

3829-
However, you probably want <code>lighten()</code> called on an <a idl>HSLColor</a> object
3830-
to return another <a idl>HSLColor</a> object.
3829+
However, you probably want <code>lighten()</code> called on an {{HSLColor}} object
3830+
to return another {{HSLColor}} object.
38313831
Using <code>CSSColor.forwardToSameClass("lighten");</code> will make this happen automatically.
38323832

38333833
Obviously, if a method does not return a color
3834-
you should not use <a idl>forwardToSameClass()</a>;
3834+
you should not use {{forwardToSameClass()}};
38353835
the results will probably not be what you want,
38363836
as it will attempt to convert whatever the return value is into an instance of the color class.
38373837
</div>
@@ -3853,7 +3853,7 @@ The CSSColor Object</h3>
38533853
<dt><dfn method>toCMYK()</dfn>
38543854
<dt><dfn method>toName()</dfn>
38553855
<dd>
3856-
All of these methods delegate to the appropriate methods on <a idl>RGBColor</a>,
3856+
All of these methods delegate to the appropriate methods on {{RGBColor}},
38573857
exactly as if created by calling <code>CSSColor.forward("asHSL")</code>, etc.
38583858

38593859
</dl>

0 commit comments

Comments
 (0)