all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* "clean" starting point for custom-theme-set-faces
@ 2014-09-17 10:00 Sam Halliday
  2014-09-17 11:41 ` Alex Kost
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Sam Halliday @ 2014-09-17 10:00 UTC (permalink / raw
  To: help-gnu-emacs

Hi all,

I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:

  https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el


But there are a couple of things that confuse me about emacs faces, even after reading the documentation and I'd appreciate some guidance:

1. When a theme is loaded, what are the default "inherit" values for all the faces that I'm defining? Is there an implicit "inherit" based on what that face was before the theme was loaded?
   I've found that I need to override a lot of things with e.g. ":underline nil" when actually I want to be defining my faces from a clean slate, inheriting from "default" without having to explicitly write that.

2. How do I re-use attributes inside custom-theme-set-faces? I can't put the list of faces inside a (let ) because custom-theme-set-faces is expecting one parameter per face. Ideally I'd like to define a bunch of things in some form of data structure so that I don't have to repeat the values, and also so that I can parametrise the theme. (e.g. I could have a function that returns my theme with a permutation on font-lock colours)


Best regards,
Sam


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "clean" starting point for custom-theme-set-faces
  2014-09-17 10:00 "clean" starting point for custom-theme-set-faces Sam Halliday
@ 2014-09-17 11:41 ` Alex Kost
       [not found] ` <mailman.9025.1410954123.1147.help-gnu-emacs@gnu.org>
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2014-09-17 11:41 UTC (permalink / raw
  To: Sam Halliday; +Cc: help-gnu-emacs

Sam Halliday (2014-09-17 14:00 +0400) wrote:

> Hi all,
>
> I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:
>
>   https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el
>
>
> But there are a couple of things that confuse me about emacs faces, even after reading the documentation and I'd appreciate some guidance:
>
> 1. When a theme is loaded, what are the default "inherit" values for all the faces that I'm defining? Is there an implicit "inherit" based on what that face was before the theme was loaded?
>    I've found that I need to override a lot of things with e.g. ":underline nil" when actually I want to be defining my faces from a clean slate, inheriting from "default" without having to explicitly write that.

IIUC you are faced with the old behavior of applying faces that will be
"fixed" in Emacs 24.4.  I wrote something about that here:
<https://github.com/alezost/alect-themes/#emacs-2431-and-earlier>.

> 2. How do I re-use attributes inside custom-theme-set-faces? I can't put the list of faces inside a (let ) because custom-theme-set-faces is expecting one parameter per face. Ideally I'd like to define a bunch of things in some form of data structure so that I don't have to repeat the values, and also so that I can parametrise the theme. (e.g. I could have a function that returns my theme with a permutation on font-lock colours)

I think you can do something like this:

(let ((faces `((default ...)
               (cursor  ...)
               ...)))
  (apply 'custom-theme-set-faces 'Darkula faces))




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "clean" starting point for custom-theme-set-faces
       [not found] ` <mailman.9025.1410954123.1147.help-gnu-emacs@gnu.org>
@ 2014-09-17 12:31   ` Sam Halliday
  2014-09-18  5:23     ` Alex Kost
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Halliday @ 2014-09-17 12:31 UTC (permalink / raw
  To: help-gnu-emacs

On Wednesday, 17 September 2014 12:41:44 UTC+1, Alex Kost  wrote:
> Sam Halliday (2014-09-17 14:00 +0400) wrote:
> > I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:
> >   https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el
> >
> > But there are a couple of things that confuse me about emacs faces, even after reading the documentation and I'd appreciate some guidance:
> >
> > 1. When a theme is loaded, what are the default "inherit" values for all the faces that I'm defining? Is there an implicit "inherit" based on what that face was before the theme was loaded?
> 
> IIUC you are faced with the old behavior of applying faces that will be
> 
> "fixed" in Emacs 24.4.  I wrote something about that here:
> 
> <https://github.com/alezost/alect-themes/#emacs-2431-and-earlier>.

Excellent, thanks! That answers my question. Although I'm a little confused how to use your workaround.

Incidentally, I was originally thinking that I could rewrite my theme to use your defaults but it seems to hardcode quite a lot of stuff.

It would be really amazing if a theme template existed that required one to only provide 10 colours and then it assigned them in a sensible way across all the various popular major modes.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "clean" starting point for custom-theme-set-faces
  2014-09-17 10:00 "clean" starting point for custom-theme-set-faces Sam Halliday
  2014-09-17 11:41 ` Alex Kost
       [not found] ` <mailman.9025.1410954123.1147.help-gnu-emacs@gnu.org>
@ 2014-09-17 15:41 ` Sam Halliday
  2014-09-18  9:52   ` Sam Halliday
  2014-09-17 16:42 ` Drew Adams
  3 siblings, 1 reply; 7+ messages in thread
From: Sam Halliday @ 2014-09-17 15:41 UTC (permalink / raw
  To: help-gnu-emacs

On Wednesday, 17 September 2014 11:00:54 UTC+1, Sam Halliday  wrote:
> I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:
>   https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el


I have a third question that I'd also like help with regarding this theme.

It would appear that when I load my custom theme (above) with

  (add-to-list 'custom-theme-load-path (concat user-emacs-directory "lisp"))
  (load-theme 'Darkula t)

not everything is set correctly. In particular (as one example), the font-lock-builtin-face (used extensively in the theme file itself) is not picking up the foreground defined in my theme.

However, if I open up the theme file and do a `C-x C-e` on the `custom-theme-set-faces` block, the theme works perfectly as intended as is evident by the colours in that file changing immediately.

Am I doing something wrong or missing something out?

Sam


^ permalink raw reply	[flat|nested] 7+ messages in thread

* RE: "clean" starting point for custom-theme-set-faces
  2014-09-17 10:00 "clean" starting point for custom-theme-set-faces Sam Halliday
                   ` (2 preceding siblings ...)
  2014-09-17 15:41 ` Sam Halliday
@ 2014-09-17 16:42 ` Drew Adams
  3 siblings, 0 replies; 7+ messages in thread
From: Drew Adams @ 2014-09-17 16:42 UTC (permalink / raw
  To: Sam Halliday, help-gnu-emacs

> I'm creating a custom colour theme

You apparently mean an Emacs custom theme.  Color themes
are something different, provided by library `color-theme.el'.

Custom themes and color themes are similar, with some overlap in
functionality.  But they are also different.

http://www.emacswiki.org/ColorAndCustomThemes



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "clean" starting point for custom-theme-set-faces
  2014-09-17 12:31   ` Sam Halliday
@ 2014-09-18  5:23     ` Alex Kost
  0 siblings, 0 replies; 7+ messages in thread
From: Alex Kost @ 2014-09-18  5:23 UTC (permalink / raw
  To: Sam Halliday; +Cc: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 1086 bytes --]

Sam Halliday (2014-09-17 16:31 +0400) wrote:

> On Wednesday, 17 September 2014 12:41:44 UTC+1, Alex Kost  wrote:
>> Sam Halliday (2014-09-17 14:00 +0400) wrote:
>> > I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:
>> >   https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el
>> >
>> > But there are a couple of things that confuse me about emacs faces,
>> > even after reading the documentation and I'd appreciate some
>> > guidance:
>> >
>> > 1. When a theme is loaded, what are the default "inherit" values for
>> > all the faces that I'm defining? Is there an implicit "inherit"
>> > based on what that face was before the theme was loaded?
>>
>> IIUC you are faced with the old behavior of applying faces that will be
>>
>> "fixed" in Emacs 24.4.  I wrote something about that here:
>>
>> <https://github.com/alezost/alect-themes/#emacs-2431-and-earlier>.
>
> Excellent, thanks! That answers my question. Although I'm a little confused how to use your workaround.

I just put the following into my ".emacs":


[-- Attachment #2: Type: application/emacs-lisp, Size: 1028 bytes --]

[-- Attachment #3: Type: text/plain, Size: 402 bytes --]


> Incidentally, I was originally thinking that I could rewrite my theme to
> use your defaults but it seems to hardcode quite a lot of stuff.
>
> It would be really amazing if a theme template existed that required one
> to only provide 10 colours and then it assigned them in a sensible way
> across all the various popular major modes.

There is some kind of template: "M-x customize-create-theme".

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: "clean" starting point for custom-theme-set-faces
  2014-09-17 15:41 ` Sam Halliday
@ 2014-09-18  9:52   ` Sam Halliday
  0 siblings, 0 replies; 7+ messages in thread
From: Sam Halliday @ 2014-09-18  9:52 UTC (permalink / raw
  To: help-gnu-emacs

On Wednesday, 17 September 2014 16:41:05 UTC+1, Sam Halliday  wrote:
> On Wednesday, 17 September 2014 11:00:54 UTC+1, Sam Halliday  wrote:
> 
> > I'm creating a custom colour theme for emacs inspired by IntelliJ's Darcula. Work in progress here:
> 
> >   https://github.com/fommil/unix/blob/master/.emacs.d/lisp/Darkula-theme.el
> 
> 
> 
> 
> 
> I have a third question that I'd also like help with regarding this theme.
> 
> 
> 
> It would appear that when I load my custom theme (above) with
> 
> 
> 
>   (add-to-list 'custom-theme-load-path (concat user-emacs-directory "lisp"))
> 
>   (load-theme 'Darkula t)
> 
> 
> 
> not everything is set correctly. In particular (as one example), the font-lock-builtin-face (used extensively in the theme file itself) is not picking up the foreground defined in my theme.
> 
> 
> 
> However, if I open up the theme file and do a `C-x C-e` on the `custom-theme-set-faces` block, the theme works perfectly as intended as is evident by the colours in that file changing immediately.
> 
> 
> 
> Am I doing something wrong or missing something out?
> 
> 
> 
> Sam

NOTE: https://github.com/alezost/alect-themes/#emacs-2431-and-earlier mentioned above seems to have fixed the problem I was having.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-09-18  9:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-17 10:00 "clean" starting point for custom-theme-set-faces Sam Halliday
2014-09-17 11:41 ` Alex Kost
     [not found] ` <mailman.9025.1410954123.1147.help-gnu-emacs@gnu.org>
2014-09-17 12:31   ` Sam Halliday
2014-09-18  5:23     ` Alex Kost
2014-09-17 15:41 ` Sam Halliday
2014-09-18  9:52   ` Sam Halliday
2014-09-17 16:42 ` Drew Adams

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.