From 3b5661186861a54a08ddb5f5863bc7ce5fa340b9 Mon Sep 17 00:00:00 2001 From: Thomas Teixeira Date: Mon, 5 Aug 2024 22:25:40 +0200 Subject: [PATCH] feat: add another random color picker example --- README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.md b/README.md index 0e69ece..01180c7 100644 --- a/README.md +++ b/README.md @@ -38,6 +38,19 @@ define-command -params 0 dabruin-random-accent %{ dabruin-random-accent ``` +If complete randomness is not really your thing, you can always use this snippet that set the accent to a random color chosen from a `str-list`. +```kak +declare-option str-list dabruin_amazing_colors 'F55E0C' '003399' +define-command -params 0 dabruin-random-accent-from-list %{ + declare-option str dabruin_accent %sh{ + set -- ${kak_opt_dabruin_amazing_colors} + eval "printf 'rgb:%s' \$$(awk "BEGIN{srand();print srand()%$#+1}")" + } + colorscheme dabruin-light +} +dabruin-random-accent-from-list +``` + ### specifics about secondary accent I've made the conscious choice of not letting user set the secondary accent, and instead, use a lighter/darker colors, derived from the primary accent. To achieve this, I could not use the dim terminal attribute, since it was not cooperating with the bold and reverse attributes on certain terminal implementation, see [this discussion](https://discuss.kakoune.com/t/question-about-dim-and-bold-attribute-in-faces/2332) for more information. -- 2.51.2