2017/11/09

用 Bash 指令產生 html 色表

【 前言 】


在編輯佈景樣式時,都會牽扯到顏色的設定;尤其是程式碼的 highlight 需要在不同背景色下選用多種顏色。所以最好能有色表參考。

以下 Bash 指令可產生 html 碼,在一種背景色下顯示 729 種前景色。


本文更新於 WordPress:
Generating HTML Color Tables with BASH Script

另有用 ImageMagick 的方法:
Generating Color Tables with ImageMagick

2017/11/02

GTK2 深灰色佈景

GTK2 使用版本:GTK 2.24。

範例:Spacefm


【GTK2 設定檔內容】


.gtkrc-2.0 檔的位置在 ~ 目錄。

# GtkSettings (見官方 "Reference Manual" II; 小括號內是預設值)

gtk-color-scheme = "gray_1: #101010"
gtk-color-scheme = "gray_2: #202020"
gtk-color-scheme = "gray_3: #303030"
gtk-color-scheme = "gray_4: #404040"
gtk-color-scheme = "gray_5: #505050"
gtk-color-scheme = "gray_6: #606060"
gtk-color-scheme = "gray_7: #707070"
gtk-color-scheme = "gray_8: #808080"
gtk-color-scheme = "gray_9: #909090"
gtk-color-scheme = "gray_a: #a0a0a0"
gtk-color-scheme = "gray_b: #b0b0b0"
gtk-color-scheme = "gray_c: #c0c0c0"
gtk-color-scheme = "gray_d: #d0d0d0"
gtk-color-scheme = "gray_e: #e0e0e0"
gtk-color-scheme = "gray_f: #f0f0f0"
gtk-color-scheme = "gray_g: #ffffff"
# A palette of named colors for use in themes ("")
gtk-color-scheme = "info_fg_color: lightgray"
gtk-color-scheme = "info_bg_color: #004000"
gtk-color-scheme = "warning_fg_color: lightgray"
gtk-color-scheme = "warning_bg_color: #804000"
gtk-color-scheme = "question_fg_color: lightgray"
gtk-color-scheme = "question_bg_color: #808000"
gtk-color-scheme = "error_fg_color: lightgray"
gtk-color-scheme = "error_bg_color: #800000"

#gtk-cursor-blink = TRUE
# Whether the cursor should blink (TRUE)

gtk-cursor-blink-time = 1000
# Length of the cursor blink cycle, in milliseconds (1200)

#gtk-cursor-blink-timeout = 2147483647
# Time after which the cursor stops blinking, in seconds (2147483647)

#gtk-cursor-theme-name = NULL
# Name of the cursor theme to use (NULL to use the default theme)

#gtk-cursor-theme-size = 0
# Size to use for cursors (0 ~ 128, 0 to use the default size)

gtk-fallback-icon-theme = "GNOME"
# Name of a icon theme to fall back to (NULL)

#gtk-font-name = "HanaMinA 13"
gtk-font-name = "AR PL UMing TW 13"
# Name of default font to use ("Sans 10")

gtk-icon-sizes = "gtk-menu=16,16:gtk-button=20,20:gtk-small-toolbar=18,18:gtk-large-toolbar=32,32:gtk-dnd=40,40:gtk-dialog=48,48"
# A list of icon sizes (NULL)

gtk-icon-theme-name = "Humanity"
# Name of icon theme to use (See index.theme file; "Hicolor")

gtk-menu-bar-accel = ""
# Keybinding to activate the menu bar ("F10")

gtk-menu-popdown-delay = 0
# The time before hiding a submenu when the pointer is moving towards the submenu (1000)

gtk-menu-popup-delay = 0
# Minimum time the pointer must stay over a menu item before the submenu appear (225)

#gtk-theme-name = "Raleigh"
# Name of theme RC file to load (Dir name, "Raleigh")

gtk-toolbar-icon-size = GTK_ICON_SIZE_SMALL_TOOLBAR
# The size of icons in default toolbars (GTK_ICON_SIZE_LARGE_TOOLBAR)

gtk-toolbar-style = GTK_TOOLBAR_ICONS
# Whether default toolbars have text only, text and icons, icons only, etc. (GTK_TOOLBAR_BOTH)

gtk-tooltip-timeout = 0
# Time, in milliseconds, after which a tooltip could appear if the cursor is hovering on top of a widget (500)

# Widgets and Objects

style "default" {
  fg[NORMAL] = @gray_f
  bg[NORMAL] = @gray_3
  text[NORMAL] = @gray_e
  base[NORMAL] = @gray_2

  fg[PRELIGHT] = @gray_f
  bg[PRELIGHT] = @gray_5
  text[PRELIGHT] = @gray_e
  base[PRELIGHT] = @gray_4

  fg[ACTIVE] = @gray_f
  bg[ACTIVE] = @gray_4
  text[ACTIVE] = @gray_f
  base[ACTIVE] = @gray_5

  fg[SELECTED] = @gray_g
  bg[SELECTED] = @gray_6
  text[SELECTED] = @gray_f
  base[SELECTED] = @gray_5

  fg[INSENSITIVE] = @gray_8
  bg[INSENSITIVE] = @gray_1
  text[INSENSITIVE] = @gray_7
  base[INSENSITIVE] = @gray_1

  xthickness = 1
  ythickness = 1

# A widget that creates a signal when clicked on
  GtkButton::child-displacement-x = 2
  # How far in the x direction to move the child when the button is depressed (0)
  GtkButton::child-displacement-y = 2
  # How far in the y direction to move the child when the button is depressed (0)
  GtkButton::default-border = { 2, 1, 2, 1 }
  # Extra space to add for GTK_CAN_DEFAULT buttons ({ 1, 1, 1, 1 })
#  GtkButton::default-outside-border = { 0, 0, 0, 0 }
  # Extra space to add for GTK_CAN_DEFAULT buttons that is always drawn outside the border ({ 0, 0, 0, 0 })
#  GtkButton::displace-focus = FALSE
  # Whether the child_displacement_x/_y properties should also affect the focus rectangle (FALSE)
#  GtkButton::image-spacing = 2
  # Spacing in pixels between the image and label (2)
#  GtkButton::inner-border = { 1, 1, 1, 1 }
  # Border between button edges and child ({ 1, 1, 1, 1 })

# Create widgets with a discrete toggle button
  GtkCheckButton::indicator-size = 18
  # Size of check or radio indicator (13)
  GtkCheckButton::indicator-spacing = 4
  # Spacing around check or radio indicator (2)

# A widget used to choose from a list of items
#  GtkComboBox::appears-as-list = FALSE
  # Whether dropdowns should look like lists rather than menus (FALSE)
#  GtkComboBox::arrow-size = 15
  # Sets the minimum size of the arrow in the combo box. Note that the arrow size is coupled to the font size, so in case a larger font is used, the arrow will be larger than set by arrow size. (15)
  GtkComboBox::shadow-type = GTK_SHADOW_OUT
  # Which kind of shadow to draw around the combo box (GTK_SHADOW_NONE)

# Create popup windows
  GtkDialog::action-area-border = 3
  # Width of border around the button area at the bottom of the dialog (5)
  GtkDialog::button-spacing = 3
  # Spacing between buttons (6)
  GtkDialog::content-area-border = 3
  # Width of border around the main dialog area (2)
  GtkDialog::content-area-spacing = 3
  # Spacing used between elements of the content area (0)

# A single line text entry field
#  GtkEntry::inner-border = {2, 2, 2, 2}
  # Border between the text and the frame ({2, 2, 2, 2})

# A menu widget
  GtkMenu::arrow-scaling = 1
  # Arbitrary constant to scale down the size of the scroll arrow (0.7)
  GtkMenu::horizontal-offset = 0
  # When the menu is a submenu, position it this number of pixels offset horizontally (-2)
  GtkMenu::horizontal-padding = 2
  # Extra space at the left and right edges of the menu (0)
  GtkMenu::vertical-offset = 2
  # When the menu is a submenu, position it this number of pixels offset vertically (0)
  GtkMenu::vertical-padding = 2
  # Extra space at the top and bottom of the menu (1)

# A subclass widget for GtkMenuShell which holds GtkMenuItem widgets
  GtkMenuBar::internal-padding = 0
  # Amount of border space between the menubar shadow and the menu items (1)

# A menu entry
  GtkMenuItem::arrow-scaling = 0.6
  # Arrow size, relative to the menu item's font size (0 ~ 2, 0.8)
  GtkMenuItem::arrow-spacing = 0
  # Space between label and arrow (10)
#  GtkMenuItem::horizontal-padding = 3
  # Padding to left and right of the menu item (3)
  GtkMenuItem::selected-shadow-type = GTK_SHADOW_ETCHED_OUT
  # Shadow type when item is selected (GTK_SHADOW_NONE)
#  GtkMenuItem::toggle-spacing = 5
  # Space between icon and label (5)
  GtkMenuItem::width-chars = 0
  # The minimum desired width of the menu item in characters (12)

# A widget with two adjustable panes
  GtkPaned::handle-size = 8
  # Width of handle (5)

# Base class for widgets which visualize an adjustment
  GtkRange::arrow-displacement-x = 2
  # How far in the x direction to move the arrow when the button is depressed (0)
  GtkRange::arrow-displacement-y = 2
  # How far in the y direction to move the arrow when the button is depressed (0)
  GtkRange::arrow-scaling = 0.8
  # The arrow size proportion relative to the scroll button size (0.5)
  GtkRange::slider-width = 10
  # Width of scrollbar or scale thumb (14)
  GtkRange::stepper-size = 16
  # Length of step buttons at ends (14)
#  GtkRange::stepper-spacing = 0
  # Spacing between the stepper buttons and thumb (0)
  GtkRange::trough-border = 2
  # Spacing between thumb/steppers and outer trough bevel (1)
  GtkRange::trough-under-steppers = 0
  # Whether to draw the trough across the full length of the range or to exclude the steppers and their spacing (TRUE, 用 FALSE 無效)

# A slider control used to select numeric values (Child of GtkRange)
  GtkScale::slider-length = 24
  # Length of scale's slider (31)
  GtkScale::value-spacing = 5
  # Space between value text and the slider/trough area (2)

# A scrollbar (Child of GtkRange)
  GtkScrollbar::has-backward-stepper = 0
  # Display the standard backward arrow button (1, TRUE/FALSE don't work)
  GtkScrollbar::has-forward-stepper = 1
  # Display the standard forward arrow button (1, TRUE/FALSE don't work)
  GtkScrollbar::has-secondary-backward-stepper = 1
  # Display a second backward arrow button on the opposite end of the scrollbar (0, TRUE/FALSE don't work)
  GtkScrollbar::has-secondary-forward-stepper = 0
  # Display a second forward arrow button on the opposite end of the scrollbar (0, TRUE/FALSE don't work)
  GtkScrollbar::min-slider-length = 14
  # Minimum length of scrollbar slider (21, GTK3 deprecated)

# Adds scrollbars to its child widget
  GtkScrolledWindow::scrollbar-spacing = 0
  # Number of pixels between the scrollbars and the scrolled window (3)

# A toolbar
  GtkToolbar::internal-padding = 2
  # Amount of border space between the toolbar shadow and the buttons (0)
  GtkToolbar::space-size = 8
  # Size of spacers (12)

# A widget for displaying both trees and lists
  GtkTreeView::even-row-color = @gray_3
  # Color to use for even rows
  GtkTreeView::expander-size = 16
  # Size of the expander arrow (12)
  GtkTreeView::horizontal-separator = 0
  # Horizontal space between cells (Must be an even number, 2)
  GtkTreeView::odd-row-color = @gray_2
  # Color to use for odd rows
  GtkTreeView::tree-line-pattern = "\000"
  # Dash pattern used to draw the tree view lines (\001\001)
  GtkTreeView::tree-line-width = 2
  # Width, in pixels, of the tree view lines (1)
  GtkTreeView::vertical-separator = 0
  # Vertical space between cells (Must be an even number, 2)

# Base class for all widgets
  GtkWidget::cursor-aspect-ratio = 0.08
  # Aspect ratio with which to draw insertion cursor (0.04)
  GtkWidget::cursor-color = "#ff0000"
  # Color with which to draw insertion cursor
  GtkWidget::focus-line-pattern = "\002"
  # Dash pattern used to draw the focus indicator (\001\001)
#  GtkWidget::focus-line-width = 1
  # Width, in pixels, of the focus indicator line (1)
  GtkWidget::focus-padding = 0
  # Width, in pixels, between focus indicator and the widget 'box' (1)
#  GtkWidget::interior-focus = TRUE
  # Whether to draw the focus indicator inside widgets (TRUE)
  GtkWidget::link-color = "#ff8040"
  # Color of unvisited links
#  GtkWidget::scroll-arrow-hlength = 16
  # Length of horizontal scroll arrows (16)
#  GtkWidget::scroll-arrow-vlength = 16
  # Length of vertical scroll arrows (16)
  GtkWidget::separator-height = 1
  # Height of separators (This property only takes effect if “wide-separators” is TRUE, 0)
  GtkWidget::separator-width = 1
  # Width of separators (This property only takes effect if “wide-separators” is TRUE, 0)
#  GtkWidget::tooltip-alpha = 255
  # Opacity of widget tooltips (255)
  GtkWidget::tooltip-radius = 3
  # Radius of widget tooltips (0)
  GtkWidget::visited-link-color = "#ff80ff"
  # Color of visited links
  GtkWidget::wide-separators = 1
  # Whether separators have configurable width and should be drawn using a box instead of a line (FALSE)
}

style "button" {
  bg[NORMAL] = @gray_4
  bg[PRELIGHT] = @gray_6
}

style "notebook" {
  bg[NORMAL] = @gray_4
  bg[ACTIVE] = @gray_2

#  GtkNotebook::arrow-spacing = 0
  # Spacing between the scroll arrows and the tabs (0)
  GtkNotebook::has-backward-stepper = 0
  # Whether the standard backward arrow button is displayed (TRUE, 用 FALSE 無效)
#  GtkNotebook::has-forward-stepper = TRUE
  # Whether the standard forward arrow button is displayed (TRUE)
  GtkNotebook::has-secondary-backward-stepper = 1
  # Whether a second backward arrow button is displayed on the opposite end of the tab area (FALSE, 用 TRUE 無效)
#  GtkNotebook::has-secondary-forward-stepper = FALSE
  # Whether a second forward arrow button is displayed on the opposite end of the tab area (FALSE)
  GtkNotebook::tab-overlap = -2
  # Size of tab overlap area (2)
}

style "toolbar" {
  bg[NORMAL] = @gray_6
}

style "tooltips" {
  xthickness = 6
  fg[NORMAL] = @gray_1
  bg[NORMAL] = @gray_a
}

class "GtkToolbar" style "toolbar"
class "GtkWidget" style "default"
widget_class "*<gtkbutton>" style "button"
widget_class "*<gtknotebook>" style "notebook"
widget "gtk-tooltip*" style "tooltips"