View Source TailColors (TailColors v0.1.1)
Summary
Functions
moves the tint down the list of tints.
takes list of classNames and starting text, and finds first instance that matches with a known color and tint, a default value can also be set
takes a list of classNames and matches the first class with the prefix and returns the match or default values
takes a list of classNames and a string, and returns true if the string is in the list
moves the tint up the list of tints.
takes a list of classNames and finds any colors that appear that are not prefixed by a string followed by a - returns a tuple of {color, tint}
substitutes a themed color from config for the actual color name.
Functions
moves the tint down the list of tints.
## Examples
iex> TailColors.darker(600, 1)
700
iex> TailColors.darker(600, 3)
900
iex> TailColors.darker(600, 9)
950
iex> TailColors.darker("text-green-400", 1)
"text-green-500"
iex> TailColors.darker("text-green-400", 9)
"text-green-950"
iex> TailColors.darker("not-a-tint", 1)
"not-a-tint"
takes list of classNames and starting text, and finds first instance that matches with a known color and tint, a default value can also be set
Examples
iex> TailColors.get("thing text-red-400 something", "text") "text-red-400"
iex> TailColors.get("thing bg-blue", "bg") "bg-blue"
iex> TailColors.get("thing else", "bg") nil
iex> TailColors.get("thing bg-monster else", "bg") nil
iex> TailColors.get("thing bg-blue-404 else", "bg") nil
iex> TailColors.get("thing else", "bg", "bg-blue-600") "bg-blue-600"
iex> TailColors.get("thing box else", ["circle", "rounded", "box"]) "box"
iex> TailColors.get("thing else", ["circle", "rounded", "box"]) nil
iex> TailColors.get("thing else", ["circle", "rounded", "box"], "rounded") "rounded"
takes a list of classNames and matches the first class with the prefix and returns the match or default values
Examples
iex> TailColors.get("thing text-red-400 something", "text", "blue", 600) "text-red-400"
iex> TailColors.get("thing text-red something", "text", "blue", 600) "text-red-600"
iex> TailColors.get("thing something", "text", "blue", 600) "text-blue-600"
takes a list of classNames and a string, and returns true if the string is in the list
Examples
iex> TailColors.has?("thing text-red-400 something", "something") true
iex> TailColors.has?("thing bg-blue", "something") false
moves the tint up the list of tints.
## Examples
iex> TailColors.lighter(600, 1)
500
iex> TailColors.lighter(600, 3)
300
iex> TailColors.lighter(600, 9)
50
iex> TailColors.lighter("text-green-400", 1)
"text-green-300"
iex> TailColors.lighter("text-green-400", 9)
"text-green-50"
iex> TailColors.lighter("not-a-tint", 1)
"not-a-tint"
takes a list of classNames and finds any colors that appear that are not prefixed by a string followed by a - returns a tuple of {color, tint}
Examples
iex> TailColors.main_color("thing red something", "blue", 700) {"red", 700}
iex> TailColors.main_color("thing red-400 something", "blue", 700) {"red", 400}
iex> TailColors.main_color("thing something", "blue", 700) {"blue", 700}
substitutes a themed color from config for the actual color name.