-module(glimra@theme). -compile([no_auto_import, nowarn_unused_vars, nowarn_unused_function, nowarn_nomatch]). -export([default_theme/0, to_css/1]). -export_type([color/0, style/0, theme/0]). -type color() :: {color, integer(), integer(), integer()}. -type style() :: {style, color(), boolean()}. -type theme() :: {theme, color(), float(), float(), float(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style(), style()}. -spec newline() -> binary(). newline() -> case libglimra:is_windows() of true -> <<"\r\n"/utf8>>; false -> <<"\n"/utf8>> end. -spec default_theme() -> theme(). default_theme() -> {theme, {color, 30, 30, 30}, 1.5, 1.25, 0.5, {style, {color, 205, 214, 244}, false}, {style, {color, 243, 139, 168}, false}, {style, {color, 205, 214, 244}, false}, {style, {color, 235, 160, 172}, false}, {style, {color, 235, 160, 172}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 180, 190, 254}, true}, {style, {color, 116, 199, 236}, false}, {style, {color, 166, 227, 161}, false}, {style, {color, 108, 112, 134}, false}, {style, {color, 245, 194, 231}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 245, 194, 231}, false}, {style, {color, 148, 226, 213}, false}, {style, {color, 245, 194, 231}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 249, 226, 175}, false}, {style, {color, 249, 226, 175}, false}, {style, {color, 249, 226, 175}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 180, 190, 254}, false}, {style, {color, 137, 180, 250}, false}, {style, {color, 250, 179, 135}, false}, {style, {color, 137, 180, 250}, false}, {style, {color, 148, 226, 213}, false}, {style, {color, 137, 180, 250}, false}, {style, {color, 137, 180, 250}, false}, {style, {color, 116, 199, 236}, false}, {style, {color, 137, 220, 235}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 245, 194, 231}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 147, 153, 178}, false}, {style, {color, 147, 153, 178}, false}, {style, {color, 147, 153, 178}, false}, {style, {color, 245, 194, 231}, false}, {style, {color, 108, 112, 134}, true}, {style, {color, 108, 112, 134}, true}, {style, {color, 203, 166, 247}, false}, {style, {color, 203, 166, 247}, false}, {style, {color, 148, 226, 213}, true}, {style, {color, 137, 220, 235}, false}}. -spec color_to_css(color()) -> binary(). color_to_css(Color) -> <<<<<<<<<<<<"rgb("/utf8, (gleam@int:to_string(erlang:element(2, Color)))/binary>>/binary, ", "/utf8>>/binary, (gleam@int:to_string(erlang:element(3, Color)))/binary>>/binary, ", "/utf8>>/binary, (gleam@int:to_string(erlang:element(4, Color)))/binary>>/binary, ")"/utf8>>. -spec style_to_css(binary(), style()) -> binary(). style_to_css(Class_name, Style) -> <<<<<<<<<<"."/utf8, Class_name/binary>>/binary, " { color: "/utf8>>/binary, (color_to_css(erlang:element(2, Style)))/binary>>/binary, "; }"/utf8>>/binary, (newline())/binary>>. -spec to_css(theme()) -> binary(). to_css(T) -> Newline = newline(), <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>/binary, Newline/binary>>/binary, (style_to_css( <<"variable"/utf8>>, erlang:element( 6, T ) ))/binary>>/binary, (style_to_css( <<"variable.builtin"/utf8>>, erlang:element( 7, T ) ))/binary>>/binary, (style_to_css( <<"variable.member"/utf8>>, erlang:element( 8, T ) ))/binary>>/binary, (style_to_css( <<"variable.parameter.builtin"/utf8>>, erlang:element( 9, T ) ))/binary>>/binary, (style_to_css( <<"variable.parameter"/utf8>>, erlang:element( 10, T ) ))/binary>>/binary, (style_to_css( <<"constant"/utf8>>, erlang:element( 11, T ) ))/binary>>/binary, (style_to_css( <<"constant.builtin"/utf8>>, erlang:element( 12, T ) ))/binary>>/binary, (style_to_css( <<"constant.macro"/utf8>>, erlang:element( 13, T ) ))/binary>>/binary, (style_to_css( <<"module"/utf8>>, erlang:element( 14, T ) ))/binary>>/binary, (style_to_css( <<"label"/utf8>>, erlang:element( 15, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* literals */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"string"/utf8>>, erlang:element( 16, T ) ))/binary>>/binary, (style_to_css( <<"string.documentation"/utf8>>, erlang:element( 17, T ) ))/binary>>/binary, (style_to_css( <<"string.escape"/utf8>>, erlang:element( 18, T ) ))/binary>>/binary, (style_to_css( <<"string.regexp"/utf8>>, erlang:element( 19, T ) ))/binary>>/binary, (style_to_css( <<"string.special"/utf8>>, erlang:element( 20, T ) ))/binary>>/binary, (style_to_css( <<"character"/utf8>>, erlang:element( 21, T ) ))/binary>>/binary, (style_to_css( <<"character.special"/utf8>>, erlang:element( 22, T ) ))/binary>>/binary, (style_to_css( <<"boolean"/utf8>>, erlang:element( 23, T ) ))/binary>>/binary, (style_to_css( <<"number"/utf8>>, erlang:element( 24, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* types */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"type"/utf8>>, erlang:element( 25, T ) ))/binary>>/binary, (style_to_css( <<"type.builtin"/utf8>>, erlang:element( 26, T ) ))/binary>>/binary, (style_to_css( <<"type.definition"/utf8>>, erlang:element( 27, T ) ))/binary>>/binary, (style_to_css( <<"attribute"/utf8>>, erlang:element( 28, T ) ))/binary>>/binary, (style_to_css( <<"attribute.builtin"/utf8>>, erlang:element( 29, T ) ))/binary>>/binary, (style_to_css( <<"property"/utf8>>, erlang:element( 30, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* functions */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"function"/utf8>>, erlang:element( 31, T ) ))/binary>>/binary, (style_to_css( <<"function.builtin"/utf8>>, erlang:element( 32, T ) ))/binary>>/binary, (style_to_css( <<"function.call"/utf8>>, erlang:element( 33, T ) ))/binary>>/binary, (style_to_css( <<"function.macro"/utf8>>, erlang:element( 34, T ) ))/binary>>/binary, (style_to_css( <<"function.method"/utf8>>, erlang:element( 35, T ) ))/binary>>/binary, (style_to_css( <<"function.method.call"/utf8>>, erlang:element( 36, T ) ))/binary>>/binary, (style_to_css( <<"constructor"/utf8>>, erlang:element( 37, T ) ))/binary>>/binary, (style_to_css( <<"operator"/utf8>>, erlang:element( 38, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* keywords */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"keyword"/utf8>>, erlang:element( 39, T ) ))/binary>>/binary, (style_to_css( <<"keyword.coroutine"/utf8>>, erlang:element( 40, T ) ))/binary>>/binary, (style_to_css( <<"keyword.function"/utf8>>, erlang:element( 41, T ) ))/binary>>/binary, (style_to_css( <<"keyword.operator"/utf8>>, erlang:element( 42, T ) ))/binary>>/binary, (style_to_css( <<"keyword.import"/utf8>>, erlang:element( 43, T ) ))/binary>>/binary, (style_to_css( <<"keyword.type"/utf8>>, erlang:element( 44, T ) ))/binary>>/binary, (style_to_css( <<"keyword.modifier"/utf8>>, erlang:element( 45, T ) ))/binary>>/binary, (style_to_css( <<"keyword.repeat"/utf8>>, erlang:element( 46, T ) ))/binary>>/binary, (style_to_css( <<"keyword.return"/utf8>>, erlang:element( 47, T ) ))/binary>>/binary, (style_to_css( <<"keyword.debug"/utf8>>, erlang:element( 48, T ) ))/binary>>/binary, (style_to_css( <<"keyword.exception"/utf8>>, erlang:element( 49, T ) ))/binary>>/binary, (style_to_css( <<"keyword.conditional"/utf8>>, erlang:element( 50, T ) ))/binary>>/binary, (style_to_css( <<"keyword.conditional.ternary"/utf8>>, erlang:element( 51, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* punctuation */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"punctuation"/utf8>>, erlang:element( 52, T ) ))/binary>>/binary, (style_to_css( <<"punctuation.bracket"/utf8>>, erlang:element( 53, T ) ))/binary>>/binary, (style_to_css( <<"punctuation.delimiter"/utf8>>, erlang:element( 54, T ) ))/binary>>/binary, (style_to_css( <<"punctuation.special"/utf8>>, erlang:element( 55, T ) ))/binary>>/binary, Newline/binary>>/binary, "/* comments */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css( <<"comment"/utf8>>, erlang:element(56, T) ))/binary>>/binary, (style_to_css( <<"comment.documentation"/utf8>>, erlang:element(57, T) ))/binary>>/binary, Newline/binary>>/binary, "/* tags */"/utf8>>/binary, Newline/binary>>/binary, (style_to_css(<<"tag"/utf8>>, erlang:element(58, T)))/binary>>/binary, (style_to_css(<<"tag.builtin"/utf8>>, erlang:element(59, T)))/binary>>/binary, (style_to_css(<<"tag.attribute"/utf8>>, erlang:element(60, T)))/binary>>/binary, (style_to_css(<<"tag.delimiter"/utf8>>, erlang:element(61, T)))/binary>>.