ENH adjust colors

This commit is contained in:
Nathan Dwarshuis 2021-07-18 14:38:41 -04:00
parent 1eab6c0690
commit 1e3974676c
3 changed files with 46 additions and 40 deletions

View File

@ -120,12 +120,12 @@ end
M.default_grid_style = Startup.grid_style( M.default_grid_style = Startup.grid_style(
PLOT_GRID_X_N, PLOT_GRID_X_N,
PLOT_GRID_Y_N, PLOT_GRID_Y_N,
Theme.BORDER_FG Theme.PLOT_GRID_FG
) )
M.default_plot_style = Startup.plot_style( M.default_plot_style = Startup.plot_style(
PLOT_NUM_POINTS, PLOT_NUM_POINTS,
Theme.BORDER_FG, Theme.PLOT_OUTLINE_FG,
Theme.PLOT_FILL_BORDER_PRIMARY, Theme.PLOT_FILL_BORDER_PRIMARY,
Theme.PLOT_FILL_BG_PRIMARY, Theme.PLOT_FILL_BG_PRIMARY,
M.default_grid_style M.default_grid_style
@ -482,7 +482,7 @@ M.initTextRows_color = function(x, y, w, spacing, labels, color, format)
} }
end end
M.initTextRows = function(x, y, w, spacing, labels) M.initTextRows_formatted = function(x, y, w, spacing, labels, format)
return M.initTextRows_color( return M.initTextRows_color(
x, x,
y, y,
@ -490,6 +490,17 @@ M.initTextRows = function(x, y, w, spacing, labels)
spacing, spacing,
labels, labels,
Theme.PRIMARY_FG, Theme.PRIMARY_FG,
format
)
end
M.initTextRows = function(x, y, w, spacing, labels)
return M.initTextRows_formatted(
x,
y,
w,
spacing,
labels,
nil nil
) )
end end

View File

@ -44,19 +44,19 @@ return function(update_freq)
local mem_total_kb = tonumber(Util.read_file('/proc/meminfo', '^MemTotal:%s+(%d+)')) local mem_total_kb = tonumber(Util.read_file('/proc/meminfo', '^MemTotal:%s+(%d+)'))
local DIAL_RADIUS = 32 local DIAL_RADIUS = 32
local DIAL_THETA_0 = math.rad(90) -- local DIAL_THETA_0 = math.rad(90)
local DIAL_THETA_1 = math.rad(360) -- local DIAL_THETA_1 = math.rad(360)
local DIAL_X = Geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2 local DIAL_X = Geometry.RIGHT_X + DIAL_RADIUS + DIAL_THICKNESS / 2
local DIAL_Y = header.bottom_y + DIAL_RADIUS + DIAL_THICKNESS / 2 local DIAL_Y = header.bottom_y + DIAL_RADIUS + DIAL_THICKNESS / 2
local dial = Common.dial(DIAL_X, DIAL_Y, DIAL_RADIUS, DIAL_THICKNESS, 0.8) local dial = Common.dial(DIAL_X, DIAL_Y, DIAL_RADIUS, DIAL_THICKNESS, 0.8)
local cache_arc = Common.arc( -- local cache_arc = Common.arc(
DIAL_X, -- DIAL_X,
DIAL_Y, -- DIAL_Y,
DIAL_RADIUS, -- DIAL_RADIUS,
DIAL_THICKNESS, -- DIAL_THICKNESS,
Theme.INDICATOR_FG_SECONDARY -- Theme.INDICATOR_FG_SECONDARY
) -- )
local text_ring = Common.initTextRing( local text_ring = Common.initTextRing(
DIAL_X, DIAL_X,
DIAL_Y, DIAL_Y,
@ -82,13 +82,14 @@ return function(update_freq)
80 80
) )
local cache = Common.initTextRows_color( -- local cache = Common.initTextRows_color(
local cache = Common.initTextRows_formatted(
TEXT_LEFT_X, TEXT_LEFT_X,
LINE_1_Y + TEXT_SPACING, LINE_1_Y + TEXT_SPACING,
SWAP_BUFFERS_WIDTH, SWAP_BUFFERS_WIDTH,
TEXT_SPACING, TEXT_SPACING,
{'Page Cache', 'Buffers', 'Kernel Slab'}, {'Page Cache', 'Buffers', 'Kernel Slab'},
Theme.SECONDARY_FG, -- Theme.SECONDARY_FG,
'%s%%' '%s%%'
) )
@ -148,9 +149,9 @@ return function(update_freq)
Dial.set(dial, used_percent) Dial.set(dial, used_percent)
Common.text_ring_set(text_ring, cr, Util.round_to_string(used_percent * 100)) Common.text_ring_set(text_ring, cr, Util.round_to_string(used_percent * 100))
local cache_theta = (DIAL_THETA_0 - DIAL_THETA_1) / mem_total_kb * memfree_kb + DIAL_THETA_1 -- local cache_theta = (DIAL_THETA_0 - DIAL_THETA_1) / mem_total_kb * memfree_kb + DIAL_THETA_1
__cairo_path_destroy(cache_arc.path) -- __cairo_path_destroy(cache_arc.path)
cache_arc.path = Arc.create_path(cr, DIAL_X, DIAL_Y, DIAL_RADIUS, dial.dial_angle, cache_theta) -- cache_arc.path = Arc.create_path(cr, DIAL_X, DIAL_Y, DIAL_RADIUS, dial.dial_angle, cache_theta)
Common.text_row_crit_set(swap, cr, Common.text_row_crit_set(swap, cr,
Util.precision_round_to_string( Util.precision_round_to_string(
@ -192,7 +193,7 @@ return function(update_freq)
update(cr) update(cr)
Dial.draw_dynamic(dial, cr) Dial.draw_dynamic(dial, cr)
Arc.draw(cache_arc, cr) -- Arc.draw(cache_arc, cr)
Common.text_ring_draw_dynamic(text_ring, cr) Common.text_ring_draw_dynamic(text_ring, cr)
Common.text_row_crit_draw_dynamic(swap, cr) Common.text_row_crit_draw_dynamic(swap, cr)

View File

@ -4,21 +4,23 @@ local Color = require 'Color'
local Util = require 'Util' local Util = require 'Util'
M.FONT = 'Neuropolitical' M.FONT = 'Neuropolitical'
-- text colors -- text colors
M.HEADER_FG = Color.rgb(0xeeeeee) M.HEADER_FG = Color.rgb(0xe0e0e0)
M.INACTIVE_TEXT_FG = Color.rgb(0xaaaaaa) M.PRIMARY_FG = Color.rgb(0xB0A6ED)
-- TODO this is also the plot label color
M.MID_GREY = Color.rgb(0xa6a6a6)
M.BORDER_FG = Color.rgb(0x666666)
M.PRIMARY_FG = Color.rgb(0xC7BDFF)
M.SECONDARY_FG = Color.rgb(0xE6D3AC)
M.CRITICAL_FG = Color.rgb(0xff8282) M.CRITICAL_FG = Color.rgb(0xff8282)
M.INACTIVE_TEXT_FG = Color.rgb(0xb7b7b7)
M.MID_GREY = Color.rgb(0xa6a6a6)
M.BORDER_FG = Color.rgb(0x5a5a5a)
M.PLOT_GRID_FG = Color.rgb(0x565656)
M.PLOT_OUTLINE_FG = Color.rgb(0x626262)
-- arc bg colors -- arc bg colors
local GREY2 = 0x9f9f9f local GREY2 = 0x939393
local GREY5 = 0x363636 local GREY5 = 0x323232
M.INDICATOR_BG = Color.gradient_rgb{ M.INDICATOR_BG = Color.gradient_rgb{
[0.0] = GREY5, [0.0] = GREY5,
[0.5] = GREY2, [0.5] = GREY2,
@ -26,22 +28,14 @@ M.INDICATOR_BG = Color.gradient_rgb{
} }
-- arc/bar fg colors -- arc/bar fg colors
local PRIMARY1 = 0xAD9DFB local PRIMARY1 = 0x9E90E6
local PRIMARY3 = 0x4020DF local PRIMARY3 = 0x432DB3
M.INDICATOR_FG_PRIMARY = Color.gradient_rgb{ M.INDICATOR_FG_PRIMARY = Color.gradient_rgb{
[0.0] = PRIMARY3, [0.0] = PRIMARY3,
[0.5] = PRIMARY1, [0.5] = PRIMARY1,
[1.0] = PRIMARY3 [1.0] = PRIMARY3
} }
local SECONDARY1 = 0xD9BC87
local SECONDARY3 = 0x59451B
M.INDICATOR_FG_SECONDARY = Color.gradient_rgb{
[0.0] = SECONDARY3,
[0.5] = SECONDARY1,
[1.0] = SECONDARY3
}
local CRITICAL1 = 0xFF3333 local CRITICAL1 = 0xFF3333
local CRITICAL3 = 0xFFB8B8 local CRITICAL3 = 0xFFB8B8
M.INDICATOR_FG_CRITICAL = Color.gradient_rgb{ M.INDICATOR_FG_CRITICAL = Color.gradient_rgb{
@ -50,7 +44,7 @@ M.INDICATOR_FG_CRITICAL = Color.gradient_rgb{
[1.0] = CRITICAL1 [1.0] = CRITICAL1
} }
-- plot patterns -- plot colors
local PLOT_PRIMARY1 = 0x15007C local PLOT_PRIMARY1 = 0x15007C
local PLOT_PRIMARY2 = 0x431EFF local PLOT_PRIMARY2 = 0x431EFF
local PLOT_PRIMARY3 = 0x4B31CE local PLOT_PRIMARY3 = 0x4B31CE
@ -66,6 +60,6 @@ M.PLOT_FILL_BG_PRIMARY = Color.gradient_rgba{
} }
-- panel pattern -- panel pattern
M.PANEL_BG = Color.rgba(0x000000, 0.7) M.PANEL_BG = Color.rgba(0x121212, 0.7)
return Util.set_finalizer(M, function() print('Cleaning up Patterns.lua') end) return Util.set_finalizer(M, function() print('Cleaning up Patterns.lua') end)