Current section

12 Versions

Jump to

Compare versions

5 files changed
+33 additions
-5 deletions
  @@ -5,6 +5,15 @@ See [Conventional Commits](Https://conventionalcommits.org) for commit guideline
5 5
6 6 <!-- changelog -->
7 7
8 + ## [v0.1.11](https://github.com/zachdaniel/tails/compare/v0.1.10...v0.1.11) (2024-05-03)
9 +
10 +
11 +
12 +
13 + ### Improvements:
14 +
15 + * support `color_classes` config
16 +
8 17 ## [v0.1.10](https://github.com/zachdaniel/tails/compare/v0.1.9...v0.1.10) (2024-03-04)
  @@ -54,7 +54,22 @@ We use custom defined colors for two things:
54 54
55 55 If you *don't* do this, there are certain cases that we are currently unable to disambiguate. For example, if you have a custom font size utility, i.e `text-really-big` and a custom color utility, used like `text-really-red`, we can't tell which is which. We don't guarantee the behavior of that combination, but as of the writing of this paragraph, they will both override the font size.
56 56
57 - I highly suggest that you configure your colors file statically if you want to use tails *or* help us figure out a way to make it unnecessary, because I can't think of one :)
57 + I highly suggest that you configure your colors file statically, or configure your colors by hand as explained below if you want to use tails *or* help us figure out a way to make it unnecessary, because I can't think of one :)
58 +
59 + ## Configuring custom colors without a colors file
60 +
61 + You can configure custom colors without a colors file by setting the following configuration:
62 +
63 + ```elixir
64 + config :tails, :color_classes, ["primary", "secondary", ...]
65 + ```
66 +
67 + or if using a custom tails module
68 +
69 + ```elixir
70 + config :my_app, Tails,
71 + color_classes: ["primary", "secondary", ...]
72 + ```
58 73
59 74 ## Merging Custom Colors
  @@ -1,6 +1,6 @@
1 1 {<<"links">>,[{<<"GitHub">>,<<"https://github.com/zachdaniel/tails">>}]}.
2 2 {<<"name">>,<<"tails">>}.
3 - {<<"version">>,<<"0.1.10">>}.
3 + {<<"version">>,<<"0.1.11">>}.
4 4 {<<"description">>,<<"A tailwind utility library for Elixir">>}.
5 5 {<<"elixir">>,<<"~> 1.14">>}.
6 6 {<<"app">>,<<"tails">>}.
  @@ -28,6 +28,7 @@ defmodule Tails.Custom do
28 28
29 29 if otp_app == :tails do
30 30 @colors_file Application.compile_env(otp_app, :colors_file)
31 + @color_classes Application.compile_env(otp_app, :color_classes) || []
31 32 @no_merge_classes Application.compile_env(otp_app, :no_merge_classes) || []
32 33 @dark_themes dark_themes || Application.compile_env(otp_app, :dark_themes)
33 34 @themes themes || Application.compile_env(otp_app, :themes)
  @@ -35,6 +36,7 @@ defmodule Tails.Custom do
35 36 @fallback_to_colors Application.compile_env(otp_app, :fallback_to_colors) || false
36 37 else
37 38 @colors_file Application.compile_env(otp_app, __MODULE__)[:colors_file]
39 + @color_classes Application.compile_env(otp_app, __MODULE__)[:color_classes] || []
38 40 @no_merge_classes Application.compile_env(otp_app, __MODULE__)[:no_merge_classes] || []
39 41 @dark_themes dark_themes || Application.compile_env(otp_app, __MODULE__)[:dark_themes]
40 42 @themes themes || Application.compile_env(otp_app, __MODULE__)[:themes]
  @@ -57,7 +59,7 @@ defmodule Tails.Custom do
57 59 Tails.Colors.builtin_colors()
58 60 end)
59 61
60 - @all_colors Tails.Colors.all_color_classes(@colors)
62 + @all_colors Tails.Colors.all_color_classes(@colors) ++ @color_classes
61 63
62 64 @colors_by_size @all_colors |> Enum.group_by(&byte_size/1)
63 65
  @@ -639,6 +641,8 @@ defmodule Tails.Custom do
639 641 "rounded"
640 642 iex> merge("rounded", "rounded-lg") |> to_string()
641 643 "rounded-lg"
644 + iex> merge("rounded", "px-2") |> to_string()
645 + "px-2 rounded"
642 646 iex> merge("border-separate", "border-spacing-1") |> to_string()
643 647 "border-spacing-1 border-separate"
644 648 iex> merge("shadow", "shadow-md") |> to_string()
  @@ -1484,7 +1488,7 @@ defmodule Tails.Custom do
1484 1488 defp direction(nil, _, _, _, _), do: ""
1485 1489
1486 1490 defp direction("", suffix, prefix, nil, dash_suffix?),
1487 - do: [prefix, dash_suffix(suffix, dash_suffix?)]
1491 + do: [" ", prefix, dash_suffix(suffix, dash_suffix?)]
1488 1492
1489 1493 defp direction("-" <> value, suffix, prefix, nil, dash_suffix?),
1490 1494 do: [" -", prefix, dash_suffix(suffix, dash_suffix?), "-", value]
  @@ -1,7 +1,7 @@
1 1 defmodule Tails.MixProject do
2 2 use Mix.Project
3 3
4 - @version "0.1.10"
4 + @version "0.1.11"
5 5
6 6 def project do
7 7 [