Skip to content

Commit 3cf45aa

Browse files
committed
DOCS: Adjust readme
1 parent 62ef0e9 commit 3cf45aa

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

README.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@ The methods rgb and hsl allow to specify the alpha as fourth argument
2424
expecting a float between 0 and 1 `color = ${ Color.hsl(156, 25, 75, 0.5) }`
2525

2626
If you have a color value specified as css color string you can use the
27-
`Color.css` method to instantiate the color.
27+
`Color.css` method to instantiate the color. Plaese be aware that this
28+
uses a very simple regex based parser for the css colors and for now only
29+
suppprts hex,rgb and hsla colors.
2830

2931
- `color = ${ Color.css('#80e619') }`
30-
- `color = ${ Color.css('rbg( 10%, 50%, 0%, 50%)') }`
31-
- `color = ${ Color.css('hsl( 270, 10%, 50%, 0.5)') }`
32+
- `color = ${ Color.css('rbg( 10%, 50%, 0%, 50%)') }`
33+
- `color = ${ Color.css('hsl( 270, 10%, 50%, 0.5)') }`
3234

3335
### Manipulating
3436

@@ -61,16 +63,13 @@ Offcourse this can be used in afx attributes as any other eel expression.
6163

6264
### Value rendering
6365

64-
When casted to string the color objects will render as hex or rgba() depending
65-
on wether an alpha value is present or not.
66+
When casted to string the color objects will render as hex value.
67+
For special requirements the format can be specified. All formats will
68+
only render an alpha value if the color is transparent.
6669

67-
For special requirements the format can be specified. Be aware that if
68-
you use the hex format alpha is ignored. The rgb and hsl formats will
69-
output the alpha if the alpha value is different from 1.
70-
71-
- `hex = ${ Color.rgba(255,0,0,0).fadein(20).hex() }` >> #ff0000
72-
- `rgb = ${ Color.rgba(255,0,0,0).fadein(20).rgb() }` >> rgba( 255, 0, 0, 0.8)
73-
- `hsl = ${ Color.rgba(255,0,0,0).fadein(20).hsl() }` >> hsla( 0, 100%, 50%, 0.8)
70+
- `hex = ${ Color.rgb(255,0,0).hex() }` >> #ff0000
71+
- `rgb = ${ Color.rgba(255,0,0).fadeout(50).rgb() }` >> rgba( 255, 0, 0, 0.5)
72+
- `hsl = ${ Color.rgba(255,0,0).hsl() }` >> hsla( 0, 100%, 50%)
7473

7574
## Installation
7675

0 commit comments

Comments
 (0)