From f5b2f34269c1c70755135bb46716b60c4c988dff Mon Sep 17 00:00:00 2001 From: Emmanuel Lepage Vallee Date: Mon, 13 Dec 2021 10:21:43 -0800 Subject: [PATCH] doc: Update some examples not to hardcode the foreground color. --- tests/examples/awful/popup/defaultconfig.lua | 3 ++- tests/examples/awful/popup/wiboxtypes.lua | 3 ++- tests/examples/awful/titlebar/defaulttitlebar.lua | 3 ++- tests/examples/awful/wibar/defaultwibar.lua | 3 ++- tests/examples/wibox/nwidget/default.lua | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/tests/examples/awful/popup/defaultconfig.lua b/tests/examples/awful/popup/defaultconfig.lua index be28439ad..b6c7ba176 100644 --- a/tests/examples/awful/popup/defaultconfig.lua +++ b/tests/examples/awful/popup/defaultconfig.lua @@ -9,6 +9,7 @@ local naughty = require("naughty") local wibox = require("wibox") local beautiful = require("beautiful") --DOC_HIDE local look = require("_default_look") +local color = require("gears.color") screen[1]._resize {width = 640, height = 340} @@ -75,7 +76,7 @@ local function create_line(x1, y1, x2, y2) return x2-x1+6, y2-y1+6 end, draw = function(_, _, cr) - cr:set_source_rgb(0,0,0) + cr:set_source(color(beautiful.fg_normal)) cr:set_line_width(1) cr:arc(1.5, 1.5, 1.5, 0, math.pi*2) cr:arc(x2-x1+1.5, y2-y1+1.5, 1.5, 0, math.pi*2) diff --git a/tests/examples/awful/popup/wiboxtypes.lua b/tests/examples/awful/popup/wiboxtypes.lua index ccbef7ba6..b36e1604e 100644 --- a/tests/examples/awful/popup/wiboxtypes.lua +++ b/tests/examples/awful/popup/wiboxtypes.lua @@ -10,6 +10,7 @@ local wibox = require("wibox") local beautiful = require("beautiful") --DOC_HIDE local assets = require("beautiful.theme_assets") local look = require("_default_look") +local color = require("gears.color") screen[1]._resize {width = 640, height = 480} @@ -233,7 +234,7 @@ local function create_line(x1, y1, x2, y2) return x2-x1+6, y2-y1+6 end, draw = function(_, _, cr) - cr:set_source_rgb(0,0,0) + cr:set_source(color(beautiful.fg_normal)) cr:set_line_width(1) cr:arc(1.5, 1.5, 1.5, 0, math.pi*2) cr:arc(x2-x1+1.5, y2-y1+1.5, 1.5, 0, math.pi*2) diff --git a/tests/examples/awful/titlebar/defaulttitlebar.lua b/tests/examples/awful/titlebar/defaulttitlebar.lua index 3e34f0b94..2db72c9c4 100644 --- a/tests/examples/awful/titlebar/defaulttitlebar.lua +++ b/tests/examples/awful/titlebar/defaulttitlebar.lua @@ -7,6 +7,7 @@ local gears = require("gears") local wibox = require("wibox") local beautiful = require("beautiful") --DOC_HIDE local look = require("_default_look") +local color = require("gears.color") local offset = 0 @@ -108,7 +109,7 @@ local function create_line(x1, y1, x2, y2) return x2-x1+6, y2-y1+6 end, draw = function(_, _, cr) - cr:set_source_rgb(0,0,0) + cr:set_source(color(beautiful.fg_normal)) cr:set_line_width(1) cr:arc(1.5, 1.5, 1.5, 0, math.pi*2) cr:arc(x2-x1+1.5, y2-y1+1.5, 1.5, 0, math.pi*2) diff --git a/tests/examples/awful/wibar/defaultwibar.lua b/tests/examples/awful/wibar/defaultwibar.lua index 309714e74..b4a90af89 100644 --- a/tests/examples/awful/wibar/defaultwibar.lua +++ b/tests/examples/awful/wibar/defaultwibar.lua @@ -7,6 +7,7 @@ local gears = require("gears") local wibox = require("wibox") local beautiful = require("beautiful") --DOC_HIDE local look = require("_default_look") +local color = require("gears.color") local offset = 60 @@ -99,7 +100,7 @@ local function create_line(x1, y1, x2, y2) return x2-x1+6, y2-y1+6 end, draw = function(_, _, cr) - cr:set_source_rgb(0,0,0) + cr:set_source(color(beautiful.fg_normal)) cr:set_line_width(1) cr:arc(1.5, 1.5, 1.5, 0, math.pi*2) cr:arc(x2-x1+1.5, y2-y1+1.5, 1.5, 0, math.pi*2) diff --git a/tests/examples/wibox/nwidget/default.lua b/tests/examples/wibox/nwidget/default.lua index 3f670c2ce..71b807967 100644 --- a/tests/examples/wibox/nwidget/default.lua +++ b/tests/examples/wibox/nwidget/default.lua @@ -7,6 +7,7 @@ local def = require("naughty.widget._default") local acommon = require("awful.widget.common") local aplace = require("awful.placement") local gears = require("gears") +local color = require("gears.color") beautiful.notification_bg = beautiful.bg_normal @@ -76,7 +77,7 @@ local function create_line(x1, y1, x2, y2) return x2-x1+6, y2-y1+6 end, draw = function(_, _, cr) - cr:set_source_rgb(0,0,0) + cr:set_source(color(beautiful.fg_normal)) cr:set_line_width(1) cr:arc(1.5, 1.5, 1.5, 0, math.pi*2) cr:arc(x2-x1+1.5, y2-y1+1.5, 1.5, 0, math.pi*2)