From 5995fe2a946d9d01e168096631353a41ea9afe40 Mon Sep 17 00:00:00 2001 From: codecalm Date: Mon, 9 Dec 2019 18:17:44 +0100 Subject: [PATCH] colors table fixes --- pages/_docs/colors.md | 53 +++-------------------- pages/_includes/example/colors-table.html | 20 +++++++++ pages/_plugins/jekyll-filters.rb | 5 +++ 3 files changed, 32 insertions(+), 46 deletions(-) create mode 100644 pages/_includes/example/colors-table.html diff --git a/pages/_docs/colors.md b/pages/_docs/colors.md index 9fb3f2f3f..809ec81f9 100644 --- a/pages/_docs/colors.md +++ b/pages/_docs/colors.md @@ -3,49 +3,10 @@ title: Colors menu: docs.colors --- -
-
-
-
-

- Default colors -

-
-
-
    - {% for color in site.colors %} -
  • -
    {{ color[1].name | first_letters | upcase }}
    -
    - {{ color[1].name }}
    - .bg-{{ color[0] }} -
    -
  • - {% endfor %} -
-
-
-
-
-
-
-

- Light colors -

-
-
-
    - {% for color in site.colors %} -
  • -
    {{ color[1].name | first_letters | upcase }}
    -
    - {{ color[1].name }} lite
    - .bg-{{ color[0] }}-lt -
    -
  • - {% endfor %} -
-
-
-
-
\ No newline at end of file +## Base colors + +{% include example/colors-table.html %} + +## Light colors + +{% include example/colors-table.html light=true %} diff --git a/pages/_includes/example/colors-table.html b/pages/_includes/example/colors-table.html new file mode 100644 index 000000000..e12e50482 --- /dev/null +++ b/pages/_includes/example/colors-table.html @@ -0,0 +1,20 @@ +{% assign colors = include.colors | default: site.colors %} +{% assign light = include.light %} + +
+
+ {% for color in colors %} +
+
+
{{ color[0] | capitalize | first_letter }}
+
+
+ {{ color[1].title }}
+ bg-{{ color[0] }}{% if light %}-lt{% endif %} +
+
+ {% endfor %} +
+
+ + diff --git a/pages/_plugins/jekyll-filters.rb b/pages/_plugins/jekyll-filters.rb index ae660c3e4..8b2423f06 100644 --- a/pages/_plugins/jekyll-filters.rb +++ b/pages/_plugins/jekyll-filters.rb @@ -84,6 +84,11 @@ module Jekyll input.gsub re, repl_str end + + def hex_to_rgb(color) + r, g, b = color.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/).captures + "rgb(#{r.hex}, #{g.hex}, #{b.hex})" + end end end