Misterio77 / flavours

🎨💧 An easy to use base16 scheme manager that integrates with any workflow.
MIT License
500 stars 29 forks source link

generated color scheme gives some weird colors #14

Closed loiccoyle closed 3 years ago

loiccoyle commented 3 years ago

Hi again,

I've really been liking flavours so far, the main gripe I have is that depending on the image the color scheme generation algorithm can give (imo) some weird color choices. Here is an example: https://imgur.com/a/U8Aa0kR as you can see the image is quite dark and basically just shades of blue, while the generated colors are very bright neon colors with not much blue, and the background color is a relatively bright purple.

I can give more examples if needed. I suspect it has trouble finding colors when an image is made up of similar shades of a color ?

I understand that colors are very much subject to personal preference, so if you disagree and deem this to be expected behaviour then please feel free to close this issue.

Misterio77 commented 3 years ago

Hmmm that's weird. I've a couple single color wallpapers in my library and didn't got such an output. This shouldn't happen. I'll be sure to investigate this in the next couple of days. Thanks for the report

Misterio77 commented 3 years ago

Oh and more examples do help! Feel free to hit me up with any other images that end up in weird palettes. (If possible, run flavours with the -v/--verbose flag before the subcommand verb to get a detailed output)

Misterio77 commented 3 years ago

I tested the picture on my setup, and apparently it generates okay colors (could be a little more blue, will look at it), but totally not that purple you got. What does your flavours and terminal configs look like?

loiccoyle commented 3 years ago

I'm glad to see that this is not intended behaviour :). It is strange that we don't get the same colours.

I ran the generation for the problematic image, here is the output:

$ flavours -v generate dark valley_night.png 
Using directory: "/home/lcoyle/.local/share/flavours"
Using config file: "/home/lcoyle/.config/flavours/config.toml"
 #b6f258   #b6f258
 #16fc04   #16fc04
 #0c17fa   #0c17fa
 #5eb1f6   #5eb1f6
 #040b15   #040b15
 #0d3883   #0d3883
 #2f6fd8   #2f6fd8
 #fc0510   #fc0510
 #fc2767   #fc2767
 #fc579a   #fc579a
 #0c2448   #0c2448
 #68fc0c   #68fc0c
 #fc1444   #fc1444
 #ff0824   #ff0824
Passes: 2
Passes: 2
 #b6f258   #b6f258
 #0c17fa   #0c17fa

 #4d4e95   #4d4e95
 #63669a   #63669a
 #787e9f   #787e9f
 #8e96a3   #8e96a3
 #a3aea8   #a3aea8
 #b9c6ad   #b9c6ad
 #c3ceb9   #c3ceb9
 #ced7c5   #ced7c5
 #fe0723   #fe0723
 #fc1444   #fc1444
 #67fc0b   #67fc0b
 #3777d7   #3777d7
 #fc569a   #fc569a
 #fc2667   #fc2667
 #fc0510   #fc0510
 #3275e3   #3275e3

Here is a screenshot of the same output: https://imgur.com/a/G6KYh1a

I don't think it is related to my terminal config, as the same strange colors are applied to other programs. In any case, here is my terminal (termite) config (after applying the theme):

[options]
scroll_on_output = false
scroll_on_keystroke = true
audible_bell = false
mouse_autohide = false
allow_bold = true
dynamic_title = true
urgent_on_bell = true
clickable_url = true
font = Hack 10
scrollback_lines = 10000
search_wrap = true
icon_name = utilities-terminal
clickable_url = true
cursor_blink = system
cursor_shape = block
browser = qutebrowser
filter_unmatched_urls = true

# *************************
# Start flavours
[colors]
# Base16 Generated
# Author: Flavours

foreground          = #b9c6ad
foreground_bold     = #b9c6ad
cursor              = #b9c6ad
cursor_foreground   = #4d4e95
background          = rgba(77, 78, 149, 0.92)

# 16 color space

# Black, Gray, Silver, White
color0  = #4d4e95
color8  = #8e96a3
color7  = #b9c6ad
color15 = #ced7c5

# Red
color1  = #fe0723
color9  = #fe0723

# Green
color2  = #3777d7
color10 = #3777d7

# Yellow
color3  = #67fc0b
color11 = #67fc0b

# Blue
color4  = #fc2667
color12 = #fc2667

# Purple
color5  = #fc0510
color13 = #fc0510

# Teal
color6  = #fc569a
color14 = #fc569a

# Extra colors
color16 = #fc1444
color17 = #3275e3
color18 = #63669a
color19 = #787e9f
color20 = #a3aea8
color21 = #c3ceb9
# End flavours
# vim: ft=cfg

Here is the template file (basically the base16 termite template with a slight change in the background color to add slight transparency):

[colors]
# Base16 {{scheme-name}}
# Author: {{scheme-author}}

foreground          = #{{base05-hex}}
foreground_bold     = #{{base05-hex}}
cursor              = #{{base05-hex}}
cursor_foreground   = #{{base00-hex}}
background          = rgba({{base00-rgb-r}}, {{base00-rgb-g}}, {{base00-rgb-b}}, 0.92)

# 16 color space

# Black, Gray, Silver, White
color0  = #{{base00-hex}}
color8  = #{{base03-hex}}
color7  = #{{base05-hex}}
color15 = #{{base07-hex}}

# Red
color1  = #{{base08-hex}}
color9  = #{{base08-hex}}

# Green
color2  = #{{base0B-hex}}
color10 = #{{base0B-hex}}

# Yellow
color3  = #{{base0A-hex}}
color11 = #{{base0A-hex}}

# Blue
color4  = #{{base0D-hex}}
color12 = #{{base0D-hex}}

# Purple
color5  = #{{base0E-hex}}
color13 = #{{base0E-hex}}

# Teal
color6  = #{{base0C-hex}}
color14 = #{{base0C-hex}}

# Extra colors
color16 = #{{base09-hex}}
color17 = #{{base0F-hex}}
color18 = #{{base01-hex}}
color19 = #{{base02-hex}}
color20 = #{{base04-hex}}
color21 = #{{base06-hex}}

And here is the flavours config:

[[item]]
file='$XDG_CONFIG_HOME/termite/config'
template='termite'
subtemplate='transparent'
hook='killall -USR1 termite'

[[item]]
file='~/.Xresources'
template='xresources'
subtemplate='default-256'
rewrite=true

[[item]]
file='$XDG_CONFIG_HOME/qutebrowser/colors.py'
template='qutebrowser'
subtemplate='minimal'
rewrite=true
hook='sh -c "pgrep -x qutebrowser && qutebrowser :config-source"'

[[item]]
file='$XDG_CONFIG_HOME/zathura/zathurarc'
template='zathura'

[[item]]
file='$XDG_CONFIG_HOME/dunst/dunstrc'
template='dunst'
subtemplate='background'
hook = 'killall dunst'

[[item]]
file='$XDG_CONFIG_HOME/polybar/config'
template='polybar'
hook='polybar-msg cmd restart'

[[item]]
file='$XDG_CONFIG_HOME/bspwm/bspwm_colors.sh'
template='bspwm'
hook='sh -c "$XDG_CONFIG_HOME/bspwm/bspwm_colors.sh"'
rewrite=true

[[item]]
file='$XDG_CONFIG_HOME/rofi/themes/colors/colors.rasi'
template='rofi'
subtemplate='colors_minimal'
rewrite=true
loiccoyle commented 3 years ago

Here is a second example where the color generation is questionable, again it seems to favour very neon colors when the background it quite sombre. https://imgur.com/a/CMBP6RG

Misterio77 commented 3 years ago

Thank you for the detailed outputs!

I suspect the png enconding (or maybe indexed colors?) may cause this.

Downloading the images from imgur (they come as jpg when i do) make them work correctly for some reason:

1

2

Edit: Cubeupload seems to be acting up, gonna try and upload on imgur done

loiccoyle commented 3 years ago

hmm interesting, so I guess a workaround would be to convert al lthe problematic images to jpg. If you want to get the "original" images, let me know how I should send them to you.

If this helps, here are the exif tags of the images:

$ exiftool valley_night.png 
ExifTool Version Number         : 12.00
File Name                       : valley_night.png
Directory                       : .
File Size                       : 11 MB
File Modification Date/Time     : 2020:02:22 16:14:07+01:00
File Access Date/Time           : 2020:02:22 16:13:56+01:00
File Inode Change Date/Time     : 2020:02:22 16:33:54+01:00
File Permissions                : rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 7680
Image Height                    : 4320
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Image Size                      : 7680x4320
Megapixels                      : 33.2
$ exiftool atat.png 
ExifTool Version Number         : 12.00
File Name                       : atat.png
Directory                       : .
File Size                       : 124 kB
File Modification Date/Time     : 2020:09:28 17:44:16+02:00
File Access Date/Time           : 2020:09:28 17:44:16+02:00
File Inode Change Date/Time     : 2020:09:30 00:11:26+02:00
File Permissions                : rw-r--r--
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 3840
Image Height                    : 2160
Bit Depth                       : 8
Color Type                      : RGB with Alpha
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Pixels Per Unit X               : 5669
Pixels Per Unit Y               : 5669
Pixel Units                     : meters
Image Size                      : 3840x2160
Megapixels                      : 8.3

I know very little about this stuff, but could it be due to the alpha channel ? see the Color Type tag.

Misterio77 commented 3 years ago

Here's the exif of a png wallpaper i have that does work:

❯ exiftool forest-pixelart-purple-gold-pasque.png                         
ExifTool Version Number         : 12.00
File Name                       : forest-pixelart-purple-gold-pasque.png
Directory                       : .
File Size                       : 23 kB
File Modification Date/Time     : 2020:11:14 00:15:40-03:00
File Access Date/Time           : 2020:11:18 18:05:51-03:00
File Inode Change Date/Time     : 2020:11:14 00:15:40-03:00
File Permissions                : rwxr-xr-x
File Type                       : PNG
File Type Extension             : png
MIME Type                       : image/png
Image Width                     : 3840
Image Height                    : 1080
Bit Depth                       : 4
Color Type                      : Palette
Compression                     : Deflate/Inflate
Filter                          : Adaptive
Interlace                       : Noninterlaced
Exif Byte Order                 : Little-endian (Intel, II)
Bits Per Sample                 : 8 8 8
Orientation                     : Horizontal (normal)
X Resolution                    : 72
Y Resolution                    : 72
Resolution Unit                 : inches
Software                        : GIMP 2.10.22
Color Space                     : sRGB
Photometric Interpretation      : YCbCr
Samples Per Pixel               : 3
Thumbnail Offset                : 316
Thumbnail Length                : 3364
Profile Name                    : ICC profile
Profile CMM Type                : Little CMS
Profile Version                 : 4.3.0
Profile Class                   : Display Device Profile
Color Space Data                : RGB
Profile Connection Space        : XYZ
Profile Date Time               : 2020:11:14 03:11:20
Profile File Signature          : acsp
Primary Platform                : Apple Computer Inc.
CMM Flags                       : Not Embedded, Independent
Device Manufacturer             : 
Device Model                    : 
Device Attributes               : Reflective, Glossy, Positive, Color
Rendering Intent                : Perceptual
Connection Space Illuminant     : 0.9642 1 0.82491
Profile Creator                 : Little CMS
Profile ID                      : 0
Profile Description             : GIMP built-in sRGB
Profile Copyright               : Public Domain
Media White Point               : 0.9642 1 0.82491
Chromatic Adaptation            : 1.04788 0.02292 -0.05022 0.02959 0.99048
 -0.01707 -0.00925 0.01508 0.75168
Red Matrix Column               : 0.43604 0.22249 0.01392
Blue Matrix Column              : 0.14305 0.06061 0.71393
Green Matrix Column             : 0.38512 0.7169 0.09706
Red Tone Reproduction Curve     : (Binary data 32 bytes, use -b option to 
extract)
Green Tone Reproduction Curve   : (Binary data 32 bytes, use -b option to 
extract)
Blue Tone Reproduction Curve    : (Binary data 32 bytes, use -b option to 
extract)
Chromaticity Channels           : 3
Chromaticity Colorant           : Unknown (0)
Chromaticity Channel 1          : 0.64 0.33002
Chromaticity Channel 2          : 0.3 0.60001
Chromaticity Channel 3          : 0.15001 0.06
Device Mfg Desc                 : GIMP
Device Model Desc               : sRGB
XMP Toolkit                     : XMP Core 4.4.0-Exiv2
Document ID                     : gimp:docid:gimp:512d30ff-5337-4076-884d-
fd3e8fb3099c
Instance ID                     : xmp.iid:71700ba6-7a65-4063-8120-668d2cff
26fc
Original Document ID            : xmp.did:548d5b13-c133-4cd4-8d95-752d956a
465d
Api                             : 2.0
Platform                        : Linux
Time Stamp                      : 1605323740697956
Version                         : 2.10.22
Format                          : image/png
Creator Tool                    : GIMP 2.10
Location Created                : 
Location Shown                  : 
Artwork Or Object               : 
Registry ID                     : 
History Action                  : saved
History Changed                 : /
History Instance ID             : xmp.iid:0541074a-24dd-4a31-872c-1b689839
7198
History Software Agent          : Gimp 2.10 (Linux)
History When                    : -03:00
Image Supplier                  : 
Image Creator                   : 
Copyright Owner                 : 
Licensor                        : 
Palette                         : (Binary data 27 bytes, use -b option to 
extract)
Background Color                : 0
Pixels Per Unit X               : 2835
Pixels Per Unit Y               : 2835
Pixel Units                     : meters
Modify Date                     : 2020:11:14 03:15:40
Image Size                      : 3840x1080
Megapixels                      : 4.1
Thumbnail Image                 : (Binary data 3364 bytes, use -b option t
o extract)
Misterio77 commented 3 years ago

I don't think i see any obvious differences (this wallpaper in specific is in an indexed color space, but i have a couple that aren't)... But I'm sure we will get to the bottom of it soon enough