Skip to content

Commit

Permalink
Final Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SirGoodenough committed Jan 11, 2024
1 parent 5612ec7 commit 9c9020b
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ This requires HomeAssistant version 2023.11.0 or greater due to the use of the l
- ~~Return a list of all the official color names.~~
- ~~Clean-up code, add shortcuts on redundancies.~~
- ~~Add ```Display closest color name to a given RGB```~~
- Push to Hacs released.
- ~~Push to Hacs released.~~

# 🔩 Installation

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

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

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

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

```jinja
{% from 'color_multi_tool.jinja' import name2rgb %}
{{ name2rgb(color_name) }}
{% set _name2rgb = name2rgb(color_name) %}
{{ [_name2rgb[0]|int(0),_name2rgb[1]|int(0),_name2rgb[2]|int(0)] | list}}
```

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

# Return the Color Name for a Provided rgb Number

## `rgb2name(_range, rgbl)`
## `rgb2name(range, rgb_formatted_list)`

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.

Expand All @@ -180,11 +181,16 @@ Another good thing to do before you ask for help is try testing what you have in
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.

SAMPLE USAGE:
{% from 'color_multi_tool.jinja' import rgb2name %}
{{ name2rgb(color_name) }}

```jinja
{% from 'color_multi_tool.jinja' import name2rgb %}
{{ rgb2name(10, rgbl) | list }}
```

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

*********************

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

```jinja
{% from 'color_multi_tool.jinja' import rgb2xy %}
{% set _rgb2xy = rgb2xy(_nrgb).split(",") | list -%}
{{ [_rgb2xy[0]|float|round(3),_rgb2xy[1]|float|round(3)] }}
{% set _rgb2xy = rgb2xy(rgbl).split(",") | list -%}
{{ [_rgb2xy[0]|float|round(3),_rgb2xy[1]|float|round(3)] | list}}
```

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

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

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

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

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

REMEMBER:
Expand Down

0 comments on commit 9c9020b

Please sign in to comment.