X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=tools%2Fgen-styles;h=64cebf27e9e8ab4d72652f6ecd735d2baa20f391;hb=1e086f32b85ad4dd255bed2108173aa41959cc8b;hp=25002e743e14d5d71f16e6ea6381453c0e9bdbfb;hpb=a27b9f88f066df4f4e70707c5d08bc8925b59b71;p=mobile-ledger.git
diff --git a/tools/gen-styles b/tools/gen-styles
index 25002e74..64cebf27 100644
--- a/tools/gen-styles
+++ b/tools/gen-styles
@@ -245,8 +245,8 @@ sub outputThemes {
sub bestLightnessForHue {
my ( $h, $s ) = @_;
- my $targetContrast = 4.07;
- my $white = Color::sRGB->WHITE;
+ my $targetContrast = $opt_night ? 5.16 : 4.07;
+ my $white = $opt_night ? Color::sRGB->BLACK : Color::sRGB->WHITE;
my $bestLightness;
my $bestContrast;
for ( my $l = 0; $l < 1; $l += 0.002 ) {
@@ -301,10 +301,12 @@ sub hslStyleForHue {
# linear interpolation
#my $l1 = $y0 + 1.0 * ( $hue - $x0 ) * ( $y1 - $y0 ) / ( $x1 - $x0 );
my $l1 = bestLightnessForHue( $hue / 360.0, $S );
+ #$l1 += ( 1 - $l1 ) * 0.20 if $opt_night;
- my $l2 = $l1 * 0.80;
- my $l3 = $opt_night ? 0.150 : 0.950;
- my $l4 = $opt_night ? 0.100 : 0.980;
+ #my $l2 = $opt_night ? ( $l1 + ( 1 - $l1 ) * 0.15 ) : $l1 * 0.85;
+ my $l2 = $l1 * 0.80;
+ my $l3 = $opt_night ? 0.150 : 0.950;
+ my $l4 = $opt_night ? 0.100 : 0.980;
my $result = "";
my $indent = "$baseIndent ";
@@ -328,9 +330,9 @@ sub hslStyleForHue {
$result .= sprintf "$indent- #00%s
\n",
'colorPrimaryTransparent', hslHex( $hue, $S, $l1 );
$result .= sprintf "$indent- #%s
\n",
- 'colorSecondary', hslHex( $hue, $S, $l2 );
+ 'colorSecondary', hslHex( $hue, $S, $l1 );
$result .= sprintf "$indent- #%s
\n",
- 'colorPrimaryDark', hslHex( $hue, $S, $l2 );
+ 'colorPrimaryDark', hslHex( $hue, $S*0.8, $l2 );
$result .= sprintf "$indent- #%s
\n",
'table_row_dark_bg', hslHex( $hue, $S, $l3 );
$result .= sprintf "$indent- #%s
\n",