Skip to content

Commit 9c9020b

Browse files
committed
Final Cleanup
1 parent 5612ec7 commit 9c9020b

File tree

1 file changed

+21
-15
lines changed

1 file changed

+21
-15
lines changed

README.md

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This requires HomeAssistant version 2023.11.0 or greater due to the use of the l
3131
- ~~Return a list of all the official color names.~~
3232
- ~~Clean-up code, add shortcuts on redundancies.~~
3333
- ~~Add ```Display closest color name to a given RGB```~~
34-
- Push to Hacs released.
34+
- ~~Push to Hacs released.~~
3535

3636
# 🔩 Installation
3737

@@ -84,7 +84,7 @@ Another good thing to do before you ask for help is try testing what you have in
8484
```jinja
8585
{% from 'color_multi_tool.jinja' import random_xy %}
8686
{% set _rxy = random_xy().split(",") | list -%}
87-
{{ [_rxy[0]|float|round(3),_rxy[1]|float|round(3)] }}
87+
{{ [_rxy[0]|float|round(3),_rxy[1]|float|round(3)] | list}}
8888
```
8989

9090
REMEMBER:
@@ -105,7 +105,7 @@ Another good thing to do before you ask for help is try testing what you have in
105105
```jinja
106106
{% from 'color_multi_tool.jinja' import random_hs %}
107107
{% set _rhs = random_hs().split(",") | list -%}
108-
{{ [_rhs[0]|float|round(2),_rhs[1]|float|round(2)] }}
108+
{{ [_rhs[0]|float|round(2),_rhs[1]|float|round(2)] | list}}
109109
```
110110

111111
REMEMBER:
@@ -126,7 +126,7 @@ Another good thing to do before you ask for help is try testing what you have in
126126
```jinja
127127
{% from 'color_multi_tool.jinja' import random_rgb %}
128128
{% set _rrgb = random_rgb().split(",") | list -%}
129-
{{ [_rrgb[0]|int(0),_rrgb[1]|int(0),_rrgb[2]|int(0)] }}
129+
{{ [_rrgb[0]|int(0),_rrgb[1]|int(0),_rrgb[2]|int(0)] | list}}
130130
```
131131

132132
REMEMBER:
@@ -158,7 +158,8 @@ Another good thing to do before you ask for help is try testing what you have in
158158

159159
```jinja
160160
{% from 'color_multi_tool.jinja' import name2rgb %}
161-
{{ name2rgb(color_name) }}
161+
{% set _name2rgb = name2rgb(color_name) %}
162+
{{ [_name2rgb[0]|int(0),_name2rgb[1]|int(0),_name2rgb[2]|int(0)] | list}}
162163
```
163164

164165
REMEMBER:
@@ -170,7 +171,7 @@ Another good thing to do before you ask for help is try testing what you have in
170171

171172
# Return the Color Name for a Provided rgb Number
172173

173-
## `rgb2name(_range, rgbl)`
174+
## `rgb2name(range, rgb_formatted_list)`
174175

175176
This template will accept a list representing an RGB value plus a range value representing the window size of the 'close enough' color name. It will return the Home Assistant Color name that matches it or is close to it within a +/- range you specify.
176177

@@ -180,11 +181,16 @@ Another good thing to do before you ask for help is try testing what you have in
180181
For default the color is set to black [0,0,0] and the range is 0, so it will by give you ['black'] for invalid input.
181182

182183
SAMPLE USAGE:
183-
{% from 'color_multi_tool.jinja' import rgb2name %}
184-
{{ name2rgb(color_name) }}
184+
185+
```jinja
186+
{% from 'color_multi_tool.jinja' import name2rgb %}
187+
{{ rgb2name(10, rgbl) | list }}
188+
```
185189

186190
REMEMBER:
187191
Everything returned from a macro template is a string.
192+
In this case, it will be a string that looks like a list of strings.
193+
You will need to cast it to actually be a list.
188194

189195
*********************
190196

@@ -204,8 +210,8 @@ Another good thing to do before you ask for help is try testing what you have in
204210

205211
```jinja
206212
{% from 'color_multi_tool.jinja' import rgb2xy %}
207-
{% set _rgb2xy = rgb2xy(_nrgb).split(",") | list -%}
208-
{{ [_rgb2xy[0]|float|round(3),_rgb2xy[1]|float|round(3)] }}
213+
{% set _rgb2xy = rgb2xy(rgbl).split(",") | list -%}
214+
{{ [_rgb2xy[0]|float|round(3),_rgb2xy[1]|float|round(3)] | list}}
209215
```
210216

211217
REMEMBER:
@@ -232,7 +238,7 @@ Another good thing to do before you ask for help is try testing what you have in
232238
```jinja
233239
{% from 'color_multi_tool.jinja' import xy2rgb %}
234240
{% set _xy2rgb = xy2rgb(xyl).split(",") | list -%}
235-
{{ [_xy2rgb[0]|int(0),_xy2rgb[1]|int(0),_xy2rgb[2]|int(0)] }}
241+
{{ [_xy2rgb[0]|int(0),_xy2rgb[1]|int(0),_xy2rgb[2]|int(0)] | list}}
236242
```
237243

238244
REMEMBER:
@@ -259,7 +265,7 @@ Another good thing to do before you ask for help is try testing what you have in
259265
```jinja
260266
{% from 'color_multi_tool.jinja' import hs2rgb %}
261267
{% set _hs2rgb = hs2rgb(hsl).split(",") | list -%}
262-
{{ [_hs2rgb[0]|int(0),_hs2rgb[1]|int(0),_hs2rgb[2]|int(0)] }}
268+
{{ [_hs2rgb[0]|int(0),_hs2rgb[1]|int(0),_hs2rgb[2]|int(0)] | list}}
263269
```
264270

265271
REMEMBER:
@@ -286,7 +292,7 @@ Another good thing to do before you ask for help is try testing what you have in
286292
```jinja
287293
{% from 'color_multi_tool.jinja' import rgb2hs %}
288294
{% set _rgb2hs = rgb2hs(rgbl).split(",") | list -%}
289-
{{[ _rgb2hs[0]|float(0)|round(3),_rgb2hs[1]|float(0)|round(3)] }}
295+
{{[ _rgb2hs[0]|float(0)|round(3),_rgb2hs[1]|float(0)|round(3)] | list}}
290296
```
291297

292298
REMEMBER:
@@ -313,7 +319,7 @@ Another good thing to do before you ask for help is try testing what you have in
313319
```jinja
314320
{% from 'color_multi_tool.jinja' import hs2xy %}
315321
{% set _hs2xy = hs2xy(hsl).split(",") | list -%}
316-
{{ [_hs2xy[0]|float|round(3),_hs2xy[1]|float|round(3)] }}
322+
{{ [_hs2xy[0]|float|round(3),_hs2xy[1]|float|round(3)] | list}}
317323
```
318324

319325
REMEMBER:
@@ -340,7 +346,7 @@ Another good thing to do before you ask for help is try testing what you have in
340346
```jinja
341347
{% from 'color_multi_tool.jinja' import xy2hs %}
342348
{% set _xy2hs = xy2hs(xyl).split(",") | list -%}
343-
{{ [_xy2hs[0]|float|round(3),_xy2hs[1]|float|round(3)] }}
349+
{{ [_xy2hs[0]|float|round(3),_xy2hs[1]|float|round(3)] | list}}
344350
```
345351

346352
REMEMBER:

0 commit comments

Comments
 (0)