Skip to content

Commit 8d8280f

Browse files
committed
Color: fix help
* fix indent to whitespaces * add noet to modeline * fix wrong argument names * write argument values' ranges * don't write about internal representation
1 parent 30da766 commit 8d8280f

File tree

1 file changed

+30
-27
lines changed

1 file changed

+30
-27
lines changed

doc/vital/Color.txt

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,18 @@ FUNCTIONS *Vital.Color-functions*
2323

2424
parse({str}) *Vital.Color.parse()*
2525
Parses various color text formats and creates |Vital.Color-Color-object|.
26-
Supported format is:
27-
* Hex RGB format
28-
* e.g. `#FFF`
29-
* e.g. `#000000`
30-
* CSS RGB format
31-
* e.g. `rgb(255,255,255)`
32-
* e.g. `rgb(100%,0%,0%)`
33-
* CSS HSL format
34-
* e.g. `hsl(0,50%,100%)`
35-
* `%` is mandatory
36-
* Color name
37-
* See $VIMRUNTIME/rgb.txt for color names
26+
Supported format is:
27+
* Hex RGB format
28+
* e.g. `#FFF`
29+
* e.g. `#000000`
30+
* CSS RGB format
31+
* e.g. `rgb(255,255,255)`
32+
* e.g. `rgb(100%,0%,0%)`
33+
* CSS HSL format
34+
* e.g. `hsl(0,50%,100%)`
35+
* `%` is mandatory
36+
* Color name
37+
* See $VIMRUNTIME/rgb.txt for color names
3838
>
3939
let c1 = s:Color.parse('#012')
4040
let c2 = s:Color.parse('#c0ffee')
@@ -45,21 +45,28 @@ parse({str}) *Vital.Color.parse()*
4545
<
4646
rgb({red}, {green}, {blue}) *Vital.Color.rgb()*
4747
Creates |Vital.Color-Color-object| with given parameters.
48+
The value ranges of {red}, {green}, {blue} are 0-255.
4849
>
4950
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb_hex() == '#001122'
5051
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb_str() == 'rgb(0,17,34)'
5152
echo s:Color.rgb(0x00, 0x11, 0x22).as_rgb() == [0.0, 17.0, 34.0]
5253
<
53-
hsl({red}, {green}, {blue}) *Vital.Color.hsl()*
54+
hsl({hue}, {saturation}, {lightness}) *Vital.Color.hsl()*
5455
Creates |Vital.Color-Color-object| with given parameters.
56+
The value ranges are:
57+
{hue} = 0-360
58+
{saturation} = 0-100
59+
{lightness} = 0-100
5560
>
5661
echo s:Color.hsl(0, 50, 100).as_hsl_str() == 'hsl(0,50%,100%)'
5762
echo s:Color.hsl(0, 50, 100).as_hsl() == [0.0, 50.0, 100.0]
5863
<
5964
xterm({code}) *Vital.Color.xterm()*
6065
Creates |Vital.Color-Color-object| with given parameters.
61-
This converts color name to RGB values internally (so `.as_rgb()`,
62-
`.as_rgb_str()`, `.as_rgb_hex()` doesn't lose the precision).
66+
The value range of {code} is 0-255.
67+
68+
This converts color name to RGB values internally (so `.as_rgb()`,
69+
`.as_rgb_str()`, `.as_rgb_hex()` doesn't lose the precision).
6370
>
6471
echo s:Color.xterm(0).as_rgb_hex() == '#000000'
6572
echo s:Color.xterm(15).as_rgb_hex() == '#FFFFFF'
@@ -70,36 +77,32 @@ COLOR OBJECT *Vital.Color-Color-object*
7077
*Vital.Color-Color.eq()*
7178
Color.eq({color})
7279
Returns |TRUE| if this object is equal to {color}.
73-
Returns |FALSE| otherwise.
80+
Returns |FALSE| otherwise.
7481

7582
*Vital.Color-Color.distance()*
7683
Color.distance({color})
7784
Returns the distance of 3D vector (r, g, b).
7885

7986
*Vital.Color-Color.as_rgb()*
8087
Color.as_rgb()
81-
Converts this object if necessary, and returns `[r, g, b]` value.
82-
r, g, b are |Float| values.
88+
Returns `[r, g, b]` value. r, g, b are |Float| values.
8389

8490
*Vital.Color-Color.as_rgb_str()*
8591
Color.as_rgb_str()
86-
Converts this object if necessary, and returns a string like
87-
`rgb({r},{g},{b})`. r, g, b are |Float| values.
92+
Returns a string like `rgb({r},{g},{b})`. r, g, b are |Float| values.
8893

8994
*Vital.Color-Color.as_rgb_hex()*
9095
Color.as_rgb_hex()
91-
Converts this object if necessary, and returns a string like
92-
`#{r}{g}{b}` (e.g. `#000000`, always 7 digits).
96+
Returns a string like `#{r}{g}{b}` (e.g. `#000000`, always 7 digits).
9397

9498
*Vital.Color-Color.as_hsl()*
9599
Color.as_hsl()
96-
Converts this object if necessary, and returns `[h, s, l]` value.
97-
h, s, l are |Float| values.
100+
Returns `[h, s, l]` value. h, s, l are |Float| values.
98101

99102
*Vital.Color-Color.as_hsl_str()*
100103
Color.as_hsl_str()
101-
Converts this object if necessary, and returns a string like
102-
`hsl({h},{s}%,{l}%)`. h, s, l are |Float| values.
104+
Returns a string like `hsl({h},{s}%,{l}%)`.
105+
h, s, l are |Float| values.
103106

104107
==============================================================================
105108
TODO *Vital.Color-todo*
@@ -108,4 +111,4 @@ TODO *Vital.Color-todo*
108111
- Convert color object to the (exact|nearest) terminal code
109112

110113
==============================================================================
111-
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl
114+
vim:tw=78:fo=tcq2mM:ts=8:ft=help:norl:noet

0 commit comments

Comments
 (0)