* Use variable in setcustom
[not found] <20191110023036.r2gsq6znmykbol7q.ref@Ergus>
@ 2019-11-10 2:30 ` Ergus
2019-11-14 9:24 ` Eli Zaretskii
2019-11-14 10:09 ` Yuri Khan
0 siblings, 2 replies; 4+ messages in thread
From: Ergus @ 2019-11-10 2:30 UTC (permalink / raw)
To: Ergus via Users list for the GNU Emacs text editor
Hi I want to have a simple colour palette that must be compatible with
tui and gui.
The problem is that the color names are not the same so for example the
brightblack are not available in gui only in tui.
To work around this I made:
```
(defconst my/colors '((black . "#000000")
(red . "#cd0000")
...
(brightcyan . "#00ffff")
(brightwhite . "#ffffff"))
"List of colors.")
```
And then I assign the colors with something like:
```
(set-face-foreground 'font-lock-preprocessor-face (cdr (assq 'magenta
my/colors)))
```
But if I try to use a better method for my colors as Stefan suggested:
(custom-set-face ...)
It doesn't work. Do we have some method to define colours or paletes?
So that I could use a similar approach like?
```
(set-face-foreground 'font-lock-preprocessor-face "mycolor")
```
Thanks in advance,
Ergus
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use variable in setcustom
2019-11-10 2:30 ` Use variable in setcustom Ergus
@ 2019-11-14 9:24 ` Eli Zaretskii
2019-11-14 10:09 ` Yuri Khan
1 sibling, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2019-11-14 9:24 UTC (permalink / raw)
To: help-gnu-emacs
> Date: Sun, 10 Nov 2019 03:30:36 +0100
> From: Ergus <spacibba@aol.com>
>
> Do we have some method to define colours or paletes?
>
> So that I could use a similar approach like?
>
> ```
> (set-face-foreground 'font-lock-preprocessor-face "mycolor")
> ```
Color names are passed to the underlying GUI system, so you cannot
easily invent your own.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Use variable in setcustom
2019-11-10 2:30 ` Use variable in setcustom Ergus
2019-11-14 9:24 ` Eli Zaretskii
@ 2019-11-14 10:09 ` Yuri Khan
2019-11-15 1:19 ` [OFFTOPIC] " VanL
1 sibling, 1 reply; 4+ messages in thread
From: Yuri Khan @ 2019-11-14 10:09 UTC (permalink / raw)
To: Ergus; +Cc: Ergus via Users list for the GNU Emacs text editor
On Sun, 10 Nov 2019 at 09:31, Ergus <spacibba@aol.com> wrote:
>
> Hi I want to have a simple colour palette that must be compatible with
> tui and gui.
The practical solution to that is to use a (stack of) terminal
emulator(s) that supports 24-bit colors.
> The problem is that the color names are not the same so for example the
> brightblack are not available in gui only in tui.
>
> To work around this I made:
>
> ```
> (defconst my/colors '((black . "#000000")
> (red . "#cd0000")
> ...
> (brightcyan . "#00ffff")
> (brightwhite . "#ffffff"))
> "List of colors.")
> ```
>
> And then I assign the colors with something like:
>
> ```
> (set-face-foreground 'font-lock-preprocessor-face (cdr (assq 'magenta
> my/colors)))
> ```
>
> But if I try to use a better method for my colors as Stefan suggested:
>
> (custom-set-face ...)
>
> It doesn't work. Do we have some method to define colours or paletes?
Custom themes. Which are arbitrary Elisp code and can thus define and
use variables:
(defconst yk-scarletred "#ef2929")
(custom-theme-set-faces 'yk-dark-theme
…
`(yk-incorrect
((((type graphic)) . (:underline (:color ,yk-scarletred :style wave)))
(((min-colors 16777216)) . (:foreground ,yk-scarletred :underline t))))
`(trailing-whitespace ((default . (:inherit yk-incorrect))))
…)
(provide-theme 'yk-dark-theme)
You can use anti-quoted variables or expressions with custom-set-face,
too (I just think themes are cleaner):
(custom-set-faces
`(font-lock-preprocessor-face
((default :foreground ,(cdr (assq 'magenta my/colors))))))
^ permalink raw reply [flat|nested] 4+ messages in thread
* [OFFTOPIC] Re: Use variable in setcustom
2019-11-14 10:09 ` Yuri Khan
@ 2019-11-15 1:19 ` VanL
0 siblings, 0 replies; 4+ messages in thread
From: VanL @ 2019-11-15 1:19 UTC (permalink / raw)
To: help-gnu-emacs
Yuri Khan <yuri.v.khan@gmail.com> writes:
> On Sun, 10 Nov 2019 at 09:31, Ergus <spacibba@aol.com> wrote:
>>
>> Hi I want to have a simple colour palette that must be compatible with
>> tui and gui.
>
> The practical solution to that is to use a (stack of) terminal
> emulator(s) that supports 24-bit colors.
>
>> The problem is that the color names are not the same so for example the
>> brightblack are not available in gui only in tui.
>>
I don't know if this is possible. Can a monochrome theme
work on gui/tui and be included in the standard source
distribution? To my eyes the color choices in the default
options feel uncomfortable. What I've learned to do is to
say change blue1 to blue3, for example. Which is doable in
gui.
--
© 2019 VanL
gpg using EEF2 37E9 3840 0D5D 9183 251E 9830 384E 9683 B835
'If the bug bites,don't fight it.' - Nancy S. Steinhardt
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-11-15 1:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20191110023036.r2gsq6znmykbol7q.ref@Ergus>
2019-11-10 2:30 ` Use variable in setcustom Ergus
2019-11-14 9:24 ` Eli Zaretskii
2019-11-14 10:09 ` Yuri Khan
2019-11-15 1:19 ` [OFFTOPIC] " VanL
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).