AKPlan.templatetags.color_gradients module

AKPlan.templatetags.color_gradients.hex_to_rgb(hex)[source]

Convert hex color to RGB color code :param hex: hex encoded color :type hex: str :return: rgb encoded version of given color :rtype: list[int]

AKPlan.templatetags.color_gradients.rgb_to_hex(rgb)[source]

Convert rgb color (list) to hex encoding (str) :param rgb: rgb encoded color :type rgb: list[int] :return: hex encoded version of given color :rtype: str

AKPlan.templatetags.color_gradients.linear_blend(start_hex, end_hex, position)[source]

Create a linear blend between two colors and return color code on given position of the range from 0 to 1 :param start_hex: hex representation of start color :type start_hex: str :param end_hex: hex representation of end color :type end_hex: str :param position: position in range from 0 to 1 :type position: float :return: hex encoded interpolated color :rtype: str

AKPlan.templatetags.color_gradients.darken(start_hex, amount)[source]

Darken the given color by the given amount (sensitivity will be cut in half)

Parameters:
  • start_hex (str) – original color

  • amount (float) – how much to darken (1.0 -> 50% darker)

Returns:

darker version of color

Return type:

str