mirror of
https://github.com/zedeus/nitter
synced 2026-09-05 22:59:31 +00:00
Add theme option
This commit is contained in:
parent
9aa4ddb30b
commit
5630a4da32
4 changed files with 21 additions and 6 deletions
|
|
@ -51,6 +51,9 @@ const prefList*: OrderedTable[string, seq[Pref]] = {
|
|||
],
|
||||
|
||||
"Display": @[
|
||||
Pref(kind: select, name: "theme", label: "Theme",
|
||||
defaultOption: "Dark"),
|
||||
|
||||
Pref(kind: checkbox, name: "hideTweetStats",
|
||||
label: "Hide tweet stats (replies, retweets, likes)",
|
||||
defaultState: false),
|
||||
|
|
@ -94,10 +97,12 @@ macro genUpdatePrefs*(): untyped =
|
|||
of input:
|
||||
result.add quote do: prefs.`ident` = xmltree.escape(strip(`value`))
|
||||
of select:
|
||||
let name = pref.name
|
||||
let options = pref.options
|
||||
let default = pref.defaultOption
|
||||
result.add quote do:
|
||||
if `value` in `options`: prefs.`ident` = `value`
|
||||
if `name` == "theme": prefs.`ident` = `value`
|
||||
elif `value` in `options`: prefs.`ident` = `value`
|
||||
else: prefs.`ident` = `default`
|
||||
|
||||
result.add quote do:
|
||||
|
|
|
|||
Loading…
Reference in a new issue