]> Freerunner's - dabruin.kak/commitdiff
feat: add another random color picker example
authorThomas Teixeira <thomas.teixeira@startmail.com>
Mon, 5 Aug 2024 20:25:40 +0000 (22:25 +0200)
committerThomas Teixeira <thomas.teixeira@startmail.com>
Mon, 5 Aug 2024 20:25:40 +0000 (22:25 +0200)
README.md

index 0e69ecef463248a13ae65d1d12d5482d3a26dde0..01180c779e876c631851f9c4ef89203b79f7748a 100644 (file)
--- 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.