Skip to content

Instantly share code, notes, and snippets.

Avatar

John Fuller johnsfuller

View GitHub Profile
@johnsfuller
johnsfuller / hubl_brightness_macro.css
Last active Aug 1, 2019
This hubl macro will determine text color based on a set background color. This macro is based off of this sass color function by John W Long https://gist.github.com/jlong/f06f5843104ee10006fe which is based off of this article http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
View hubl_brightness_macro.css
{# This macro is based off of this sass color function by John W Long
# https://gist.github.com/jlong/f06f5843104ee10006fe
# which gets its brightness math from this article:
# http://www.nbdtech.com/Blog/archive/2008/04/27/Calculating-the-Perceived-Brightness-of-a-Color.aspx
# Thanks to Matt Coley (https://github.com/mattcoley) and the HubSpot Team
# for introducing the root filter which makes this macro possible.
#}
{% macro find_text_color(bg_color) %}
{%- set rgb_array = bg_color|convert_rgb|split(',') -%}
You can’t perform that action at this time.