Skip to content

Instantly share code, notes, and snippets.

@nogweii
Last active February 20, 2023 17:54
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nogweii/4478505 to your computer and use it in GitHub Desktop.
Save nogweii/4478505 to your computer and use it in GitHub Desktop.
The current color scheme I use in my gnome terminal, plus accompanying ruby script which generated it
---
:blue: "#3465A4"
:cyan: "#06989A"
:green: "#4E9A06"
:bright_red: "#EF2929"
:bright_yellow: "#FCE94F"
:bright_purple: "#AD7FA8"
:bright_white: "#EEEEEC"
:red: "#CC0000"
:yellow: "#C4A000"
:purple: "#75507B"
:bright_black: "#555753"
:bright_green: "#8AE234"
:white: "#D3D7CF"
:bright_cyan: "#34E2E2"
:black: "#2E3436"
:bright_blue: "#729FCF"
:foreground: "#FFFFDD"
:background: "#000000"
# foreground & background colors. get them with "gconftool-2 -g '/apps/gnome-terminal/profiles/Default/background_color' '/apps/gnome-terminal/profiles/Default/foreground_color'"
["#FFFFFFFFDDDD", "#000000000000"]
["#FFFFFFFFDDDD", "#000000000000"].map{|c| "#" + c[1...3] + c[5...7] + c[9...11] }
# => ["#FFFFDD", "#000000"]
[:foreground, :background].zip ["#FFFFFFFFDDDD", "#000000000000"].map{|c| "#" + c[1...3] + c[5...7] + c[9...11] }
# => [[:foreground, "#FFFFDD"], [:background, "#000000"]]
Hash[[:foreground, :background].zip ["#FFFFFFFFDDDD", "#000000000000"].map{|c| "#" + c[1...3] + c[5...7] + c[9...11] }]
# => {:foreground=>"#FFFFDD", :background=>"#000000"}
# This string is from the gconf XML dump, you can get your's by running "gconftool-2 -g '/apps/gnome-terminal/profiles/Default/palette'"
palette_string = "#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC"
# => "#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC"
# Converting the 16bit colors to 8bit HTML colors... probably not the most correct way, but it works
"#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC".split(':').map{|c| "#" + c[1...3] + c[5...7] + c[9...11] }
#=> ["#2E3436", "#CC0000", "#4E9A06", "#C4A000", "#3465A4", "#75507B", "#06989A", "#D3D7CF", "#555753", "#EF2929", "#8AE234", "#FCE94F", "#729FCF", "#AD7FA8", "#34E2E2", "#EEEEEC"]
# Matches the order of colors in the GUI, which is the same order that the palette is in
carray = [:black, :red, :green, :yellow, :blue, :purple, :cyan, :white]
# => [:black, :red, :green, :yellow, :blue, :purple, :cyan, :white]
# paired with the 'brighter' versions
carray.map { |s| "bright_#{s}".to_sym }
# => [:bright_black, :bright_red, :bright_green, :bright_yellow, :bright_blue, :bright_purple, :bright_cyan, :bright_white]
# save the results
bit_colors = ("#2E2E34343636:#CCCC00000000:#4E4E9A9A0606:#C4C4A0A00000:#34346565A4A4:#757550507B7B:#060698209A9A:#D3D3D7D7CFCF:#555557575353:#EFEF29292929:#8A8AE2E23434:#FCFCE9E94F4F:#72729F9FCFCF:#ADAD7F7FA8A8:#3434E2E2E2E2:#EEEEEEEEECEC".split(':').map{|c| "#" + c[1...3] + c[5...7] + c[9...11] })
# A nice array of pairs
(carray + carray.map { |s| "bright_#{s}".to_sym }).zip(bit_colors)
# => [[:black, "#2E3436"], [:red, "#CC0000"], [:green, "#4E9A06"], [:yellow, "#C4A000"], [:blue, "#3465A4"], [:purple, "#75507B"], [:cyan, "#06989A"], [:white, "#D3D7CF"], [:bright_black, "#555753"], [:bright_red, "#EF2929"], [:bright_green, "#8AE234"], [:bright_yellow, "#FCE94F"], [:bright_blue, "#729FCF"], [:bright_purple, "#AD7FA8"], [:bright_cyan, "#34E2E2"], [:bright_white, "#EEEEEC"]]
# And make YAML via a Hash
require 'yaml'
puts (Hash[(carray + carray.map { |s| "bright_#{s}".to_sym }).zip(bit_colors)].to_yaml)
@wddaa18
Copy link

wddaa18 commented Jun 30, 2020

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment