aboutsummaryrefslogtreecommitdiff
path: root/aoc2023/build/dev/erlang/gleam_community_colour
diff options
context:
space:
mode:
authorH.J <thechairman@thechairman.info>2024-10-09 11:35:09 -0400
committerH.J <thechairman@thechairman.info>2024-10-09 11:35:09 -0400
commit6156a9ef7be4012063a042aafb4e9b0d7eadde8e (patch)
tree5d990ded3baba51ca3934b51994285f7d5915c34 /aoc2023/build/dev/erlang/gleam_community_colour
parentef2ad0ee020b6754c230ae08f5979948b8db1350 (diff)
downloadgleam_aoc-6156a9ef7be4012063a042aafb4e9b0d7eadde8e.tar.gz
gleam_aoc-6156a9ef7be4012063a042aafb4e9b0d7eadde8e.zip
cleanup
Diffstat (limited to 'aoc2023/build/dev/erlang/gleam_community_colour')
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam@@compile.erl157
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cachebin28499 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache_metabin123 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.erl513
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cachebin3174 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache_metabin96 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.erl75
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour.beambin19680 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour@accessibility.beambin4096 -> 0 bytes
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community_colour.app7
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Hsla.hrl1
-rw-r--r--aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Rgba.hrl1
12 files changed, 0 insertions, 754 deletions
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam@@compile.erl b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam@@compile.erl
deleted file mode 100644
index 543db88..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam@@compile.erl
+++ /dev/null
@@ -1,157 +0,0 @@
-#!/usr/bin/env escript
-
-% TODO: Don't concurrently print warnings and errors
-% TODO: Some tests
-
--record(arguments, {lib = "./", out = "./", modules = []}).
-
-main(Args) ->
- #arguments{out = Out, lib = Lib, modules = Modules} = parse(Args),
- IsElixirModule = fun(Module) ->
- filename:extension(Module) =:= ".ex"
- end,
- {ElixirModules, ErlangModules} = lists:partition(IsElixirModule, Modules),
- ok = configure_logging(),
- ok = add_lib_to_erlang_path(Lib),
- ok = filelib:ensure_dir([Out, $/]),
- {ErlangOk, _ErlangBeams} = compile_erlang(ErlangModules, Out),
- {ElixirOk, _ElixirBeams} = case ErlangOk of
- true -> compile_elixir(ElixirModules, Out);
- false -> {false, []}
- end,
- case ErlangOk and ElixirOk of
- true -> ok;
- false -> erlang:halt(1)
- end.
-
-compile_erlang(Modules, Out) ->
- Workers = start_compiler_workers(Out),
- ok = producer_loop(Modules, Workers),
- collect_results({true, []}).
-
-collect_results(Acc = {Result, Beams}) ->
- receive
- {compiled, Beam} -> collect_results({Result, [Beam | Beams]});
- failed -> collect_results({false, Beams})
- after 0 -> Acc
- end.
-
-producer_loop([], 0) ->
- ok;
-producer_loop([], Workers) ->
- receive
- {work_please, _} -> producer_loop([], Workers - 1)
- end;
-producer_loop([Module | Modules], Workers) ->
- receive
- {work_please, Worker} ->
- erlang:send(Worker, {module, Module}),
- producer_loop(Modules, Workers)
- end.
-
-start_compiler_workers(Out) ->
- Parent = self(),
- NumSchedulers = erlang:system_info(schedulers),
- SpawnWorker = fun(_) ->
- erlang:spawn_link(fun() -> worker_loop(Parent, Out) end)
- end,
- lists:foreach(SpawnWorker, lists:seq(1, NumSchedulers)),
- NumSchedulers.
-
-worker_loop(Parent, Out) ->
- Options = [report_errors, report_warnings, debug_info, {outdir, Out}],
- erlang:send(Parent, {work_please, self()}),
- receive
- {module, Module} ->
- log({compiling, Module}),
- case compile:file(Module, Options) of
- {ok, ModuleName} ->
- Beam = filename:join(Out, ModuleName) ++ ".beam",
- Message = {compiled, Beam},
- log(Message),
- erlang:send(Parent, Message);
- error ->
- log({failed, Module}),
- erlang:send(Parent, failed)
- end,
- worker_loop(Parent, Out)
- end.
-
-compile_elixir(Modules, Out) ->
- Error = [
- "The program elixir was not found. Is it installed?",
- $\n,
- "Documentation for installing Elixir can be viewed here:",
- $\n,
- "https://elixir-lang.org/install.html"
- ],
- case Modules of
- [] -> {true, []};
- _ ->
- log({starting, "compiler.app"}),
- ok = application:start(compiler),
- log({starting, "elixir.app"}),
- case application:start(elixir) of
- ok -> do_compile_elixir(Modules, Out);
- _ ->
- io:put_chars(standard_error, [Error, $\n]),
- {false, []}
- end
- end.
-
-do_compile_elixir(Modules, Out) ->
- ModuleBins = lists:map(fun(Module) ->
- log({compiling, Module}),
- list_to_binary(Module)
- end, Modules),
- OutBin = list_to_binary(Out),
- Options = [{dest, OutBin}],
- % Silence "redefining module" warnings.
- % Compiled modules in the build directory are added to the code path.
- % These warnings result from recompiling loaded modules.
- % TODO: This line can likely be removed if/when the build directory is cleaned before every compilation.
- 'Elixir.Code':compiler_options([{ignore_module_conflict, true}]),
- case 'Elixir.Kernel.ParallelCompiler':compile_to_path(ModuleBins, OutBin, Options) of
- {ok, ModuleAtoms, _} ->
- ToBeam = fun(ModuleAtom) ->
- Beam = filename:join(Out, atom_to_list(ModuleAtom)) ++ ".beam",
- log({compiled, Beam}),
- Beam
- end,
- {true, lists:map(ToBeam, ModuleAtoms)};
- {error, Errors, _} ->
- % Log all filenames associated with modules that failed to compile.
- % Note: The compiler prints compilation errors upon encountering them.
- ErrorFiles = lists:usort([File || {File, _, _} <- Errors]),
- Log = fun(File) ->
- log({failed, binary_to_list(File)})
- end,
- lists:foreach(Log, ErrorFiles),
- {false, []};
- _ -> {false, []}
- end.
-
-add_lib_to_erlang_path(Lib) ->
- code:add_paths(filelib:wildcard([Lib, "/*/ebin"])).
-
-parse(Args) ->
- parse(Args, #arguments{}).
-
-parse([], Arguments) ->
- Arguments;
-parse(["--lib", Lib | Rest], Arguments) ->
- parse(Rest, Arguments#arguments{lib = Lib});
-parse(["--out", Out | Rest], Arguments) ->
- parse(Rest, Arguments#arguments{out = Out});
-parse([Module | Rest], Arguments = #arguments{modules = Modules}) ->
- parse(Rest, Arguments#arguments{modules = [Module | Modules]}).
-
-configure_logging() ->
- Enabled = os:getenv("GLEAM_LOG") /= false,
- persistent_term:put(gleam_logging_enabled, Enabled).
-
-log(Term) ->
- case persistent_term:get(gleam_logging_enabled) of
- true -> erlang:display(Term), ok;
- false -> ok
- end.
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache
deleted file mode 100644
index c12620f..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache_meta b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache_meta
deleted file mode 100644
index 3584f7e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.erl b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.erl
deleted file mode 100644
index 2bb8422..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour.erl
+++ /dev/null
@@ -1,513 +0,0 @@
--module(gleam_community@colour).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([from_rgb255/3, from_rgb/3, from_rgba/4, from_hsla/4, from_hsl/3, from_rgb_hex/1, from_rgb_hex_string/1, from_rgba_hex/1, from_rgba_hex_string/1, to_rgba/1, to_hsla/1, to_css_rgba_string/1, to_rgba_hex/1, to_rgba_hex_string/1, to_rgb_hex/1, to_rgb_hex_string/1]).
--export_type([colour/0]).
-
--opaque colour() :: {rgba, float(), float(), float(), float()} |
- {hsla, float(), float(), float(), float()}.
-
--spec valid_colour_value(float()) -> {ok, float()} | {error, nil}.
-valid_colour_value(C) ->
- case (C > 1.0) orelse (C < +0.0) of
- true ->
- {error, nil};
-
- false ->
- {ok, C}
- end.
-
--spec hue_to_rgb(float(), float(), float()) -> float().
-hue_to_rgb(Hue, M1, M2) ->
- H = case Hue of
- _ when Hue < +0.0 ->
- Hue + 1.0;
-
- _ when Hue > 1.0 ->
- Hue - 1.0;
-
- _ ->
- Hue
- end,
- H_t_6 = H * 6.0,
- H_t_2 = H * 2.0,
- H_t_3 = H * 3.0,
- case H of
- _ when H_t_6 < 1.0 ->
- M1 + (((M2 - M1) * H) * 6.0);
-
- _ when H_t_2 < 1.0 ->
- M2;
-
- _ when H_t_3 < 2.0 ->
- M1 + (((M2 - M1) * ((2.0 / 3.0) - H)) * 6.0);
-
- _ ->
- M1
- end.
-
--spec hex_string_to_int(binary()) -> {ok, integer()} | {error, nil}.
-hex_string_to_int(Hex_string) ->
- Hex = case Hex_string of
- <<"#"/utf8, Hex_number/binary>> ->
- Hex_number;
-
- <<"0x"/utf8, Hex_number@1/binary>> ->
- Hex_number@1;
-
- _ ->
- Hex_string
- end,
- _pipe = Hex,
- _pipe@1 = gleam@string:lowercase(_pipe),
- _pipe@2 = gleam@string:to_graphemes(_pipe@1),
- _pipe@3 = gleam@list:reverse(_pipe@2),
- gleam@list:index_fold(
- _pipe@3,
- {ok, 0},
- fun(Total, Char, Index) -> case Total of
- {error, nil} ->
- {error, nil};
-
- {ok, V} ->
- gleam@result:then(case Char of
- <<"a"/utf8>> ->
- {ok, 10};
-
- <<"b"/utf8>> ->
- {ok, 11};
-
- <<"c"/utf8>> ->
- {ok, 12};
-
- <<"d"/utf8>> ->
- {ok, 13};
-
- <<"e"/utf8>> ->
- {ok, 14};
-
- <<"f"/utf8>> ->
- {ok, 15};
-
- _ ->
- gleam@int:parse(Char)
- end, fun(Num) ->
- gleam@result:then(
- gleam@int:power(16, gleam@int:to_float(Index)),
- fun(Base) ->
- {ok,
- V + gleam@float:round(
- gleam@int:to_float(Num) * Base
- )}
- end
- )
- end)
- end end
- ).
-
--spec hsla_to_rgba(float(), float(), float(), float()) -> {float(),
- float(),
- float(),
- float()}.
-hsla_to_rgba(H, S, L, A) ->
- M2 = case L =< 0.5 of
- true ->
- L * (S + 1.0);
-
- false ->
- (L + S) - (L * S)
- end,
- M1 = (L * 2.0) - M2,
- R = hue_to_rgb(H + (1.0 / 3.0), M1, M2),
- G = hue_to_rgb(H, M1, M2),
- B = hue_to_rgb(H - (1.0 / 3.0), M1, M2),
- {R, G, B, A}.
-
--spec rgba_to_hsla(float(), float(), float(), float()) -> {float(),
- float(),
- float(),
- float()}.
-rgba_to_hsla(R, G, B, A) ->
- Min_colour = gleam@float:min(R, gleam@float:min(G, B)),
- Max_colour = gleam@float:max(R, gleam@float:max(G, B)),
- H1 = case true of
- _ when Max_colour =:= R ->
- gleam@float:divide(G - B, Max_colour - Min_colour);
-
- _ when Max_colour =:= G ->
- _pipe = gleam@float:divide(B - R, Max_colour - Min_colour),
- gleam@result:then(_pipe, fun(D) -> {ok, 2.0 + D} end);
-
- _ ->
- _pipe@1 = gleam@float:divide(R - G, Max_colour - Min_colour),
- gleam@result:then(_pipe@1, fun(D@1) -> {ok, 4.0 + D@1} end)
- end,
- H2 = case H1 of
- {ok, V} ->
- {ok, V * (1.0 / 6.0)};
-
- _ ->
- H1
- end,
- H3 = case H2 of
- {ok, V@1} when V@1 < +0.0 ->
- V@1 + 1.0;
-
- {ok, V@2} ->
- V@2;
-
- _ ->
- +0.0
- end,
- L = (Min_colour + Max_colour) / 2.0,
- S = case true of
- _ when Min_colour =:= Max_colour ->
- +0.0;
-
- _ when L < 0.5 ->
- case (Max_colour + Min_colour) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> (Max_colour - Min_colour) / Gleam@denominator
- end;
-
- _ ->
- case ((2.0 - Max_colour) - Min_colour) of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> (Max_colour - Min_colour) / Gleam@denominator@1
- end
- end,
- {H3, S, L, A}.
-
--spec from_rgb255(integer(), integer(), integer()) -> {ok, colour()} |
- {error, nil}.
-from_rgb255(Red, Green, Blue) ->
- gleam@result:then(
- begin
- _pipe = Red,
- _pipe@1 = gleam@int:to_float(_pipe),
- _pipe@2 = gleam@float:divide(_pipe@1, 255.0),
- gleam@result:then(_pipe@2, fun valid_colour_value/1)
- end,
- fun(R) ->
- gleam@result:then(
- begin
- _pipe@3 = Green,
- _pipe@4 = gleam@int:to_float(_pipe@3),
- _pipe@5 = gleam@float:divide(_pipe@4, 255.0),
- gleam@result:then(_pipe@5, fun valid_colour_value/1)
- end,
- fun(G) ->
- gleam@result:then(
- begin
- _pipe@6 = Blue,
- _pipe@7 = gleam@int:to_float(_pipe@6),
- _pipe@8 = gleam@float:divide(_pipe@7, 255.0),
- gleam@result:then(_pipe@8, fun valid_colour_value/1)
- end,
- fun(B) -> {ok, {rgba, R, G, B, 1.0}} end
- )
- end
- )
- end
- ).
-
--spec from_rgb(float(), float(), float()) -> {ok, colour()} | {error, nil}.
-from_rgb(Red, Green, Blue) ->
- gleam@result:then(
- valid_colour_value(Red),
- fun(R) ->
- gleam@result:then(
- valid_colour_value(Green),
- fun(G) ->
- gleam@result:then(
- valid_colour_value(Blue),
- fun(B) -> {ok, {rgba, R, G, B, 1.0}} end
- )
- end
- )
- end
- ).
-
--spec from_rgba(float(), float(), float(), float()) -> {ok, colour()} |
- {error, nil}.
-from_rgba(Red, Green, Blue, Alpha) ->
- gleam@result:then(
- valid_colour_value(Red),
- fun(R) ->
- gleam@result:then(
- valid_colour_value(Green),
- fun(G) ->
- gleam@result:then(
- valid_colour_value(Blue),
- fun(B) ->
- gleam@result:then(
- valid_colour_value(Alpha),
- fun(A) -> {ok, {rgba, R, G, B, A}} end
- )
- end
- )
- end
- )
- end
- ).
-
--spec from_hsla(float(), float(), float(), float()) -> {ok, colour()} |
- {error, nil}.
-from_hsla(Hue, Saturation, Lightness, Alpha) ->
- gleam@result:then(
- valid_colour_value(Hue),
- fun(H) ->
- gleam@result:then(
- valid_colour_value(Saturation),
- fun(S) ->
- gleam@result:then(
- valid_colour_value(Lightness),
- fun(L) ->
- gleam@result:then(
- valid_colour_value(Alpha),
- fun(A) -> {ok, {hsla, H, S, L, A}} end
- )
- end
- )
- end
- )
- end
- ).
-
--spec from_hsl(float(), float(), float()) -> {ok, colour()} | {error, nil}.
-from_hsl(Hue, Saturation, Lightness) ->
- from_hsla(Hue, Saturation, Lightness, 1.0).
-
--spec from_rgb_hex(integer()) -> {ok, colour()} | {error, nil}.
-from_rgb_hex(Hex) ->
- case (Hex > 16#ffffff) orelse (Hex < 0) of
- true ->
- {error, nil};
-
- false ->
- R = begin
- _pipe = erlang:'bsr'(Hex, 16),
- erlang:'band'(_pipe, 16#ff)
- end,
- G = begin
- _pipe@1 = erlang:'bsr'(Hex, 8),
- erlang:'band'(_pipe@1, 16#ff)
- end,
- B = erlang:'band'(Hex, 16#ff),
- from_rgb255(R, G, B)
- end.
-
--spec from_rgb_hex_string(binary()) -> {ok, colour()} | {error, nil}.
-from_rgb_hex_string(Hex_string) ->
- gleam@result:then(
- hex_string_to_int(Hex_string),
- fun(Hex_int) -> from_rgb_hex(Hex_int) end
- ).
-
--spec from_rgba_hex(integer()) -> {ok, colour()} | {error, nil}.
-from_rgba_hex(Hex) ->
- case (Hex > 16#ffffffff) orelse (Hex < 0) of
- true ->
- {error, nil};
-
- false ->
- _assert_subject = begin
- _pipe = erlang:'bsr'(Hex, 24),
- _pipe@1 = erlang:'band'(_pipe, 16#ff),
- _pipe@2 = gleam@int:to_float(_pipe@1),
- gleam@float:divide(_pipe@2, 255.0)
- end,
- {ok, R} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"from_rgba_hex"/utf8>>,
- line => 588})
- end,
- _assert_subject@1 = begin
- _pipe@3 = erlang:'bsr'(Hex, 16),
- _pipe@4 = erlang:'band'(_pipe@3, 16#ff),
- _pipe@5 = gleam@int:to_float(_pipe@4),
- gleam@float:divide(_pipe@5, 255.0)
- end,
- {ok, G} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"from_rgba_hex"/utf8>>,
- line => 594})
- end,
- _assert_subject@2 = begin
- _pipe@6 = erlang:'bsr'(Hex, 8),
- _pipe@7 = erlang:'band'(_pipe@6, 16#ff),
- _pipe@8 = gleam@int:to_float(_pipe@7),
- gleam@float:divide(_pipe@8, 255.0)
- end,
- {ok, B} = case _assert_subject@2 of
- {ok, _} -> _assert_subject@2;
- _assert_fail@2 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@2,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"from_rgba_hex"/utf8>>,
- line => 600})
- end,
- _assert_subject@3 = begin
- _pipe@9 = erlang:'band'(Hex, 16#ff),
- _pipe@10 = gleam@int:to_float(_pipe@9),
- gleam@float:divide(_pipe@10, 255.0)
- end,
- {ok, A} = case _assert_subject@3 of
- {ok, _} -> _assert_subject@3;
- _assert_fail@3 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@3,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"from_rgba_hex"/utf8>>,
- line => 606})
- end,
- from_rgba(R, G, B, A)
- end.
-
--spec from_rgba_hex_string(binary()) -> {ok, colour()} | {error, nil}.
-from_rgba_hex_string(Hex_string) ->
- gleam@result:then(
- hex_string_to_int(Hex_string),
- fun(Hex_int) -> from_rgba_hex(Hex_int) end
- ).
-
--spec to_rgba(colour()) -> {float(), float(), float(), float()}.
-to_rgba(Colour) ->
- case Colour of
- {rgba, R, G, B, A} ->
- {R, G, B, A};
-
- {hsla, H, S, L, A@1} ->
- hsla_to_rgba(H, S, L, A@1)
- end.
-
--spec to_hsla(colour()) -> {float(), float(), float(), float()}.
-to_hsla(Colour) ->
- case Colour of
- {hsla, H, S, L, A} ->
- {H, S, L, A};
-
- {rgba, R, G, B, A@1} ->
- rgba_to_hsla(R, G, B, A@1)
- end.
-
--spec to_css_rgba_string(colour()) -> binary().
-to_css_rgba_string(Colour) ->
- {R, G, B, A} = to_rgba(Colour),
- Percent = fun(X) ->
- _assert_subject = begin
- _pipe = X,
- _pipe@1 = gleam@float:multiply(_pipe, 10000.0),
- _pipe@2 = gleam@float:round(_pipe@1),
- _pipe@3 = gleam@int:to_float(_pipe@2),
- gleam@float:divide(_pipe@3, 100.0)
- end,
- {ok, P} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"to_css_rgba_string"/utf8>>,
- line => 704})
- end,
- P
- end,
- Round_to = fun(X@1) ->
- _assert_subject@1 = begin
- _pipe@4 = X@1,
- _pipe@5 = gleam@float:multiply(_pipe@4, 1000.0),
- _pipe@6 = gleam@float:round(_pipe@5),
- _pipe@7 = gleam@int:to_float(_pipe@6),
- gleam@float:divide(_pipe@7, 1000.0)
- end,
- {ok, R@1} = case _assert_subject@1 of
- {ok, _} -> _assert_subject@1;
- _assert_fail@1 ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail@1,
- module => <<"gleam_community/colour"/utf8>>,
- function => <<"to_css_rgba_string"/utf8>>,
- line => 716})
- end,
- R@1
- end,
- gleam@string:join(
- [<<"rgba("/utf8>>,
- <<(gleam@float:to_string(Percent(R)))/binary, "%,"/utf8>>,
- <<(gleam@float:to_string(Percent(G)))/binary, "%,"/utf8>>,
- <<(gleam@float:to_string(Percent(B)))/binary, "%,"/utf8>>,
- gleam@float:to_string(Round_to(A)),
- <<")"/utf8>>],
- <<""/utf8>>
- ).
-
--spec to_rgba_hex(colour()) -> integer().
-to_rgba_hex(Colour) ->
- {R, G, B, A} = to_rgba(Colour),
- Red = begin
- _pipe = R * 255.0,
- _pipe@1 = gleam@float:round(_pipe),
- erlang:'bsl'(_pipe@1, 24)
- end,
- Green = begin
- _pipe@2 = G * 255.0,
- _pipe@3 = gleam@float:round(_pipe@2),
- erlang:'bsl'(_pipe@3, 16)
- end,
- Blue = begin
- _pipe@4 = B * 255.0,
- _pipe@5 = gleam@float:round(_pipe@4),
- erlang:'bsl'(_pipe@5, 8)
- end,
- Alpha = begin
- _pipe@6 = A * 255.0,
- gleam@float:round(_pipe@6)
- end,
- ((Red + Green) + Blue) + Alpha.
-
--spec to_rgba_hex_string(colour()) -> binary().
-to_rgba_hex_string(Colour) ->
- _pipe = to_rgba_hex(Colour),
- gleam@int:to_base16(_pipe).
-
--spec to_rgb_hex(colour()) -> integer().
-to_rgb_hex(Colour) ->
- {R, G, B, _} = to_rgba(Colour),
- Red = begin
- _pipe = R * 255.0,
- _pipe@1 = gleam@float:round(_pipe),
- erlang:'bsl'(_pipe@1, 16)
- end,
- Green = begin
- _pipe@2 = G * 255.0,
- _pipe@3 = gleam@float:round(_pipe@2),
- erlang:'bsl'(_pipe@3, 8)
- end,
- Blue = begin
- _pipe@4 = B * 255.0,
- gleam@float:round(_pipe@4)
- end,
- (Red + Green) + Blue.
-
--spec to_rgb_hex_string(colour()) -> binary().
-to_rgb_hex_string(Colour) ->
- _pipe = to_rgb_hex(Colour),
- gleam@int:to_base16(_pipe).
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache
deleted file mode 100644
index 5c98611..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache_meta b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache_meta
deleted file mode 100644
index 0c78df4..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.cache_meta
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.erl b/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.erl
deleted file mode 100644
index 4370842..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/_gleam_artefacts/gleam_community@colour@accessibility.erl
+++ /dev/null
@@ -1,75 +0,0 @@
--module(gleam_community@colour@accessibility).
--compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]).
-
--export([luminance/1, contrast_ratio/2, maximum_contrast/2]).
-
--spec intensity(float()) -> float().
-intensity(Colour_value) ->
- case true of
- _ when Colour_value =< 0.03928 ->
- Colour_value / 12.92;
-
- _ ->
- _assert_subject = gleam@float:power(
- (Colour_value + 0.055) / 1.055,
- 2.4
- ),
- {ok, I} = case _assert_subject of
- {ok, _} -> _assert_subject;
- _assert_fail ->
- erlang:error(#{gleam_error => let_assert,
- message => <<"Assertion pattern match failed"/utf8>>,
- value => _assert_fail,
- module => <<"gleam_community/colour/accessibility"/utf8>>,
- function => <<"intensity"/utf8>>,
- line => 62})
- end,
- I
- end.
-
--spec luminance(gleam_community@colour:colour()) -> float().
-luminance(Colour) ->
- {R, G, B, _} = gleam_community@colour:to_rgba(Colour),
- R_intensity = intensity(R),
- G_intensity = intensity(G),
- B_intensity = intensity(B),
- ((0.2126 * R_intensity) + (0.7152 * G_intensity)) + (0.0722 * B_intensity).
-
--spec contrast_ratio(
- gleam_community@colour:colour(),
- gleam_community@colour:colour()
-) -> float().
-contrast_ratio(Colour_a, Colour_b) ->
- Luminance_a = luminance(Colour_a) + 0.05,
- Luminance_b = luminance(Colour_b) + 0.05,
- case Luminance_a > Luminance_b of
- true ->
- case Luminance_b of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator -> Luminance_a / Gleam@denominator
- end;
-
- false ->
- case Luminance_a of
- +0.0 -> +0.0;
- -0.0 -> -0.0;
- Gleam@denominator@1 -> Luminance_b / Gleam@denominator@1
- end
- end.
-
--spec maximum_contrast(
- gleam_community@colour:colour(),
- list(gleam_community@colour:colour())
-) -> {ok, gleam_community@colour:colour()} | {error, nil}.
-maximum_contrast(Base, Colours) ->
- _pipe = Colours,
- _pipe@1 = gleam@list:sort(
- _pipe,
- fun(Colour_a, Colour_b) ->
- Contrast_a = contrast_ratio(Base, Colour_a),
- Contrast_b = contrast_ratio(Base, Colour_b),
- gleam@float:compare(Contrast_b, Contrast_a)
- end
- ),
- gleam@list:first(_pipe@1).
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour.beam b/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour.beam
deleted file mode 100644
index 008c06a..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour@accessibility.beam b/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour@accessibility.beam
deleted file mode 100644
index 15e491b..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community@colour@accessibility.beam
+++ /dev/null
Binary files differ
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community_colour.app b/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community_colour.app
deleted file mode 100644
index 51800d3..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/ebin/gleam_community_colour.app
+++ /dev/null
@@ -1,7 +0,0 @@
-{application, gleam_community_colour, [
- {vsn, "1.2.0"},
- {applications, [gleam_stdlib]},
- {description, "Colour types, conversions, and other utilities"},
- {modules, []},
- {registered, []}
-]}.
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Hsla.hrl b/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Hsla.hrl
deleted file mode 100644
index 06116df..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Hsla.hrl
+++ /dev/null
@@ -1 +0,0 @@
--record(hsla, {h :: float(), s :: float(), l :: float(), a :: float()}).
diff --git a/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Rgba.hrl b/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Rgba.hrl
deleted file mode 100644
index fff139e..0000000
--- a/aoc2023/build/dev/erlang/gleam_community_colour/include/gleam_community@colour_Rgba.hrl
+++ /dev/null
@@ -1 +0,0 @@
--record(rgba, {r :: float(), g :: float(), b :: float(), a :: float()}).