]> git.ktnx.net Git - mobile-ledger.git/commitdiff
declare available themes
authorDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Feb 2019 20:12:30 +0000 (22:12 +0200)
committerDamyan Ivanov <dam+mobileledger@ktnx.net>
Sun, 17 Feb 2019 20:12:30 +0000 (22:12 +0200)
app/src/main/res/values/styles.xml
tools/gen-styles [new file with mode: 0644]

index 4622e2a9962e3a38805b64fb15e0fd7b622c4032..0221dc13376e4fe112638e4fb16e9dfb5ae82db7 100644 (file)
     <!-- Base application theme. -->
     <style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
         <!-- Customize your theme here. -->
-        <item name="colorPrimary">@color/colorPrimary</item>
-        <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
-        <item name="colorAccent">@color/colorAccent</item>
+        <item name="colorPrimary">#935FF2</item>
+        <item name="colorAccent">#653BD0</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#286c33d4</item>
+        <item name="table_row_light_bg">#28ddcbff</item>
+        <item name="textColor">#d0000000</item>
     </style>
 
+    <!-- base hue: 261.2245° -->
     <style name="AppTheme.NoActionBar">
         <item name="windowActionBar">false</item>
         <item name="windowNoTitle">true</item>
+        <item name="textColor">#d0000000</item>
+        <item name="colorPrimary">#875cd6</item>
+        <item name="colorAccent">#6013ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#efe7fd</item>
+        <item name="table_row_light_bg">#f9f6fe</item>
     </style>
+    <style name="AppTheme.NoActionBar.0" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d65c5c</item>
+        <item name="colorAccent">#ec1313</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fde7e7</item>
+        <item name="table_row_light_bg">#fef6f6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.15" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d67a5c</item>
+        <item name="colorAccent">#ec4913</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fdede7</item>
+        <item name="table_row_light_bg">#fef8f6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.30" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d6995c</item>
+        <item name="colorAccent">#ec8013</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fdf2e7</item>
+        <item name="table_row_light_bg">#fefaf6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.45" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d6b85c</item>
+        <item name="colorAccent">#ecb613</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fdf8e7</item>
+        <item name="table_row_light_bg">#fefcf6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.60" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d6d65c</item>
+        <item name="colorAccent">#ecec13</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fdfde7</item>
+        <item name="table_row_light_bg">#fefef6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.75" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#b8d65c</item>
+        <item name="colorAccent">#b6ec13</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#f8fde7</item>
+        <item name="table_row_light_bg">#fcfef6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.90" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#99d65c</item>
+        <item name="colorAccent">#80ec13</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#f2fde7</item>
+        <item name="table_row_light_bg">#fafef6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.105" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#7ad65c</item>
+        <item name="colorAccent">#49ec13</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#edfde7</item>
+        <item name="table_row_light_bg">#f8fef6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.120" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cd65c</item>
+        <item name="colorAccent">#13ec13</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7fde7</item>
+        <item name="table_row_light_bg">#f6fef6</item>
+    </style>
+    <style name="AppTheme.NoActionBar.135" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cd67a</item>
+        <item name="colorAccent">#13ec49</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7fded</item>
+        <item name="table_row_light_bg">#f6fef8</item>
+    </style>
+    <style name="AppTheme.NoActionBar.150" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cd699</item>
+        <item name="colorAccent">#13ec80</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7fdf2</item>
+        <item name="table_row_light_bg">#f6fefa</item>
+    </style>
+    <style name="AppTheme.NoActionBar.165" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cd6b8</item>
+        <item name="colorAccent">#13ecb6</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7fdf8</item>
+        <item name="table_row_light_bg">#f6fefc</item>
+    </style>
+    <style name="AppTheme.NoActionBar.180" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cd6d6</item>
+        <item name="colorAccent">#13ecec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7fdfd</item>
+        <item name="table_row_light_bg">#f6fefe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.195" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5cb8d6</item>
+        <item name="colorAccent">#13b6ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7f8fd</item>
+        <item name="table_row_light_bg">#f6fcfe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.210" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5c99d6</item>
+        <item name="colorAccent">#1380ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7f2fd</item>
+        <item name="table_row_light_bg">#f6fafe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.225" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5c7ad6</item>
+        <item name="colorAccent">#1349ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7edfd</item>
+        <item name="table_row_light_bg">#f6f8fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.240" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#5c5cd6</item>
+        <item name="colorAccent">#1313ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#e7e7fd</item>
+        <item name="table_row_light_bg">#f6f6fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.255" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#7a5cd6</item>
+        <item name="colorAccent">#4913ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#ede7fd</item>
+        <item name="table_row_light_bg">#f8f6fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.270" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#995cd6</item>
+        <item name="colorAccent">#8013ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#f2e7fd</item>
+        <item name="table_row_light_bg">#faf6fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.285" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#b85cd6</item>
+        <item name="colorAccent">#b613ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#f8e7fd</item>
+        <item name="table_row_light_bg">#fcf6fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.300" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d65cd6</item>
+        <item name="colorAccent">#ec13ec</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fde7fd</item>
+        <item name="table_row_light_bg">#fef6fe</item>
+    </style>
+    <style name="AppTheme.NoActionBar.315" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d65cb8</item>
+        <item name="colorAccent">#ec13b6</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fde7f8</item>
+        <item name="table_row_light_bg">#fef6fc</item>
+    </style>
+    <style name="AppTheme.NoActionBar.330" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d65c99</item>
+        <item name="colorAccent">#ec1380</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fde7f2</item>
+        <item name="table_row_light_bg">#fef6fa</item>
+    </style>
+    <style name="AppTheme.NoActionBar.345" parent="AppTheme.NoActionBar">
+        <item name="colorPrimary">#d65c7a</item>
+        <item name="colorAccent">#ec1349</item>
+        <item name="drawer_background">#ffffffff</item>
+        <item name="table_row_dark_bg">#fde7ed</item>
+        <item name="table_row_light_bg">#fef6f8</item>
+    </style>
+
+    <string-array name="profile_colors">
+        <item>-1</item>
+        <item>0</item>
+        <item>15</item>
+        <item>30</item>
+        <item>45</item>
+        <item>60</item>
+        <item>75</item>
+        <item>90</item>
+        <item>105</item>
+        <item>120</item>
+        <item>135</item>
+        <item>150</item>
+        <item>165</item>
+        <item>180</item>
+        <item>195</item>
+        <item>210</item>
+        <item>225</item>
+        <item>240</item>
+        <item>255</item>
+        <item>270</item>
+        <item>285</item>
+        <item>300</item>
+        <item>315</item>
+        <item>330</item>
+        <item>345</item>
+    </string-array>
 
     <style name="AppTheme.AppBarOverlay" parent="ThemeOverlay.AppCompat.Dark.ActionBar" />
 
diff --git a/tools/gen-styles b/tools/gen-styles
new file mode 100644 (file)
index 0000000..f4aecdf
--- /dev/null
@@ -0,0 +1,166 @@
+#!/usr/bin/perl
+
+use strict; use warnings; use utf8;
+
+sub hexTuple {
+       my ($r, $g, $b) = @_;
+       return sprintf('%02x%02x%02x', int(255*$r+0.5), int(255*$g+0.5), int(255*$b+0.5));
+}
+sub hsvHex {
+       my ($hue, $sat, $val ) = @_;
+       my $h = int($hue * 6);
+       my $f = $hue * 6 - $h;
+       my $p = $val * (1 - $sat);
+       my $q = $val * ( 1 - $f * $sat);
+       my $t = $val * ( 1 - (1-$f) * $sat);
+
+       return hexTuple($val, $t, $p) if $h == 0 or $h == 6;
+       return hexTuple($q, $val, $p) if $h == 1;
+       return hexTuple($p, $val, $t) if $h == 2;
+       return hexTuple($p, $q, $val) if $h == 3;
+       return hexTuple($t, $p, $val) if $h == 4;
+       return hexTuple($val, $p, $q) if $h == 5;
+
+       die $h;
+}
+
+# https://en.wikipedia.org/wiki/HSL_and_HSV#From_HSL
+sub hslHex {
+       my ($hue, $sat, $lig ) = @_;
+       my $h = ($hue * 6);
+       my $c = (1 - abs(2.0*$lig - 1)) * $sat;
+       my $h_mod_2 = $h - 2*int($h/2);
+       my $x = $c * (1 - abs($h_mod_2 - 1));
+       my ($r, $g, $b);
+       my $m = $lig - $c / 2.0;
+
+       return hexTuple($c + $m, $x + $m,  0 + $m) if $h < 1 or $h == 6;
+       return hexTuple($x + $m, $c + $m,  0 + $m) if $h < 2;
+       return hexTuple( 0 + $m, $c + $m, $x + $m) if $h < 3;
+       return hexTuple( 0 + $m, $x + $m, $c + $m) if $h < 4;
+       return hexTuple($x + $m,  0 + $m, $c + $m) if $h < 5;
+       return hexTuple($c + $m,  0 + $m, $x + $m) if $h < 6;
+
+       die $h;
+}
+
+my @hexDigit = split //, '0123456789abcdef';
+my %hexValue = map(
+               (lc($hexDigit[$_]) => $_, uc($hexDigit[$_]) => $_ ),
+               0..15 );
+
+sub min {
+       my $min = shift;
+
+       for (@_) { $min = $_ if $_ < $min }
+
+       return $min;
+}
+
+sub max {
+       my $max = shift;
+
+       for (@_) { $max = $_ if $_ > $max }
+
+       return $max;
+}
+
+sub hexToHSL {
+       my $hexTriplet = shift;
+       my ( $r,$g,$b ) = $hexTriplet =~ /^#?(..)(..)(..)/;
+       for ($r,$g,$b) {
+               my @d = split(//);
+               $_ = 16 * $hexValue{$d[0]} + $hexValue{$d[1]};
+       }
+
+       warn "$hexTriplet -> $r:$g:$b";
+
+       for ($r, $g, $b ) { $_ = $_ / 255.0 }
+
+       my $M = max($r, $g, $b);
+       my $m = min($r, $g, $b);
+       my $C = $M - $m;
+
+       my $h;
+       if ($C == 0) {
+               $h = 0;
+       }
+       elsif ( $r == $M ) {
+               $h = ($g-$b)/$C;
+               $h -= 6*int($h/6.0);
+       }
+       elsif ( $g == $M ) {
+               $h = ($b-$r)/$C + 2;
+       }
+       elsif ( $b == $M ) {
+               $h = ($r-$g)/$C + 4;
+       }
+       else { die "$C, $M, $r, $g, $b"; }
+
+       my $H = 60 * $h;
+       my $L = ($M + $m) / 2;
+
+       my $S = ( $L <= 0.5 ) ? $C/(2*$L) : $C / (2-2*$L);
+
+       return( $H, $S, $L );
+}
+
+my $baseColorHSV = [ hexToHSL('#935ff2') ];
+my $baseColorHue = $baseColorHSV->[0];
+warn sprintf( 'H:%1.4f S:%1.4f L:%1.4f', @$baseColorHSV );
+warn sprintf( 'H:%1.4f S:%1.4f L:%1.4f', hexToHSL('#3e148c') );
+
+my $baseTheme = "AppTheme.NoActionBar";
+
+# # hsb
+# for( my $hue = 0; $hue < 360; $hue += 15 ) {
+#      printf "<style name=\"%s.%d\" parent=\"%s\">\n",
+#              $baseTheme, $hue, $baseTheme;
+#      printf "  <item name=\"colorPrimary\">#%s</item>\n",
+#                      hsvHex($hue/360.0, 0.61, 0.95);
+#      printf "  <item name=\"colorPrimaryDark\">#%s</item>\n",
+#                      hsvHex($hue/360.0, 0.86, 0.55);
+#      printf "  <item name=\"colorAccent\">#%s</item>\n",
+#                      hsvHex(($hue-4)/360.0, 0.72, 0.82);
+#      printf "  <item name=\"drawer_background\">#ffffffff</item>\n";
+#      printf "  <item name=\"table_row_dark_bg\">#28%s</item>\n",
+#                      hsvHex($hue/360.0, 0.65, 0.83);
+#      printf "  <item name=\"table_row_light_bg\">#28%s</item>\n",
+#                      hsvHex($hue/360.0, 0.20, 1.00);
+#      printf "  <item name=\"header_border\">#80%s</item>\n",
+#                      hsvHex(($hue+6)/360.0, 0.86, 0.55);
+#      printf "</style>\n";
+# }
+
+# HSL
+hslStyleForHue($baseColorHue);
+for( my $hue = 0; $hue < 360; $hue += 15 ) {
+       hslStyleForHue($hue, $baseTheme);
+}
+
+sub hslStyleForHue {
+       my $hue = shift;
+       my $base = shift;
+
+       if ($base) {
+               printf "<style name=\"%s.%d\" parent=\"%s\">\n",
+                       $baseTheme, $hue, $baseTheme;
+       }
+       else {
+               printf "<style name=\"%s\">\n",
+                       $baseTheme;
+               printf "  <item name=\"windowActionBar\">false</item>\n";
+               printf "  <item name=\"windowNoTitle\">true</item>\n";
+               printf "  <item name=\"textColor\">#d0000000</item>\n";
+       }
+       printf "  <item name=\"colorPrimary\">#%s</item>\n",
+                       hslHex($hue/360.0, 0.60, 0.60);
+       printf "  <item name=\"colorAccent\">#%s</item>\n",
+                       hslHex($hue/360.0, 0.85, 0.50);
+       printf "  <item name=\"drawer_background\">#ffffffff</item>\n";
+       printf "  <item name=\"table_row_dark_bg\">#%s</item>\n",
+                       hslHex($hue/360.0, 0.85, 0.95);
+       printf "  <item name=\"table_row_light_bg\">#%s</item>\n",
+                       hslHex($hue/360.0, 0.85, 0.98);
+       printf "</style>\n";
+}