I'd like to have emacs not to have a background color when I open a frame in the terminal. I'm using a terminal with a translucent background, and characters with a background color are not "see-through". TERM is set to "xterm-256color".
I put the above code in my init file, but only suppresses the background when opening an emacsclient in a terminal, and not emacs itself (i.e. only when invoked with emacsclient -t and not when invoked with emacs). Adding an extra (unless window-system (set-face-background 'default "unspecified-bg" (selected-frame))) doesn't work and only confuses graphical frames.
Although it has a setback, if the terminal has a different background settings than the theme I use (dark vs. light), default theme faces are being used which may not seem good on the light or dark background. but in my case which both terminal and theme are dark it works fine.
There are already two answers to this question, one using window-setup-hook, which is called on startup, and another using after-make-frame-functions, which is called when a new frame is made, including after invoking emacsclient. To cover all possible cases, I found that I needed to do it this way:
Custom themes are collections of settings that can be enabledor disabled as a unit. You can use Custom themes to switch easilybetween various collections of settings, and to transfer suchcollections from one computer to another.
A Custom theme is stored as an Emacs Lisp source file. If the name ofthe Custom theme is name, the theme file is namedname-theme.el. See Creating Custom Themes, for theformat of a theme file and how to make one.
If you want Emacs to look for Custom themes in some other directory,add the directory to the list variablecustom-theme-load-path. Its default value is(custom-theme-directory t); here, the symbolcustom-theme-directory has the special meaning of the value ofthe variable custom-theme-directory, while t stands forthe built-in theme directory etc/themes. The themes listed inthe *Custom Themes* buffer are those found in the directoriesspecified by custom-theme-load-path.
Setting or saving Custom themes actually works by customizing thevariable custom-enabled-themes. The value of this variable isa list of Custom theme names (as Lisp symbols, e.g., tango).Instead of using the *Custom Themes* buffer to setcustom-enabled-themes, you can customize the variable using theusual customization interface, e.g., with M-x customize-option.Note that Custom themes are not allowed to setcustom-enabled-themes themselves.
You can enable a specific Custom theme in the current Emacs sessionby typing M-x load-theme. This prompts for a theme name, loadsthe theme from the theme file, and enables it. If a theme filehas been loaded before, you can enable the theme without loading itsfile by typing M-x enable-theme. To disable a Custom theme,type M-x disable-theme.
Some themes have variants (most often just two: light and dark). Youcan switch to another variant using M-x theme-choose-variant.If the currently active theme has only one other variant, it will beselected; if there are more variants, the command will prompt youwhich one to switch to.
The Modus themes are designed for accessible readability. Theyconform with the highest standard for color contrast betweencombinations of background and foreground values. For small sizedtext, this corresponds to the WCAG AAA standard, which specifies aminimum rate of distance in relative luminance of 7:1.
To ensure that users have a consistently accessible experience, thethemes strive to achieve as close to full face coverage as possible,while still targeting a curated list of well-maintained packages(Face coverage).
From time to time, we receive bug reports pertaining to errors withbyte compilation. These seldom have to do with faulty code in thethemes: it might be a shortcoming of package.el, someregression in the current development target of Emacs, amisconfiguration in an otherwise exotic setup, and the like.
NOTE that Emacs can load multiple themes, which typically producesundesirable results and undoes the work of the designer. Use thedisable-theme command if you are trying other themes beside theModus collection (Option for disabling other themes while loading Modus).
Users of the built-in themes cannot require the package as usualbecause there is no package to speak of. Instead, things are simpleras built-in themes are considered safe. All one needs is to load thetheme of their preference by adding either form to their init file:
The modus-themes-load-theme takes care to disable other themes, ifthe user opts in (Option for disabling other themes while loading Modus).After loading the theme of choice, this function calls thehook modus-themes-after-load-theme-hook (alias modus-themes-post-load-hook).Users can add their own functions to this hook to make furthercustomizations (Advanced customization).
The version of the Modus themes that is included in Emacs CANNOT usethe standard require. This is because the built-in themes are notincluded in the load-path (not my decision). The require-themefunction must be used in this case as a replacement. For example:
As such, load-theme reads all customizations that may happen duringany given Emacs session: even after the initial setup of a theme.Examples are calls to custom-set-faces, as well as new values assignedto the options the Modus themes provide (Customization Options).
Our tests show that enable-theme does not read such variables anew, soit might appear to the unsuspecting user that the themes are somehowbroken whenever they try to assign a new value to a customization optionor some face.
The Modus themes are highly configurable, though they should work wellwithout any further tweaks. We provide a variety of user options.The following code block provides an overview. In addition to thosevariables, the themes support a comprehensive system of overrides: itcan be used to make thoroughgoing changes to the looks of the themes(Option for palette overrides). We document everything at length inthe pages of this manual and also provide ready-to-use code samples.
When the value is non-nil, the commands modus-themes-toggle andmodus-themes-select, as well as the modus-themes-load-themefunction, will disable all other themes while loading the specifiedModus theme (Option for which themes to toggle). This is done toensure that Emacs does not blend two or more themes: such blends leadto awkward results that undermine the work of the designer.
This option is provided because Emacs themes are not necessarilylimited to colors/faces: they can consist of an arbitrary set ofcustomizations. Users who use such customization bundles must setthis variable to a nil value.
The symbol of a font weight attribute such as light, semibold, etcetera, adds the given weight to links. Valid symbols are defined inthe variable modus-themes-weights. The absence of a weight meansthat the one of the underlying text will be used.
The symbol of a weight attribute adjusts the font of the headingaccordingly, such as light, semibold, etc. Valid symbols aredefined in the variable modus-themes-weights. The absence of a weightmeans that bold will be used by virtue of inheriting the bold face.
Note that the text color of headings, of their background, andoverline can all be set via the overrides. It is possible to have anycolor combination for any heading level (something that could not bedone in older versions of the themes).
Both of those subsets can be overridden, thus refashioning the theme.Overrides are either shared, by being stored in the user optionmodus-themes-common-palette-overrides, or they are specific to thetheme they name. In the latter case, the naming scheme of eachpalette variable is THEME-NAME-palette-overrides, thus yielding:
Theme-specific overrides take precedence over the shared ones. It isstrongly advised that shared overrides do NOT alter color values, asthose will not be appropriate for both dark and light themes. Commonoverrides are best limited to the semantic color mappings as those usethe color value that corresponds to the active theme (e.g. make thecursor blue-warmer in all themes, whatever the value ofblue-warmer is in each theme).
Unlike the predefined customization options which follow a clear patternof allowing the user to quickly specify their preference, the themesalso provide a more flexible, albeit difficult, mechanism to controlthings with precision (Customization Options).
This section shows how to refashion the themes by opting in to thestylistic presets we provide. Those presets override the defaultcolor mappings to amplify, tone down, or refashion the overallcoloration of the themes.
With modus-themes-preset-overrides-faint the grays are toned down,gray backgrounds are removed from some contexts, and almost all accentcolors are desaturated. It makes the themes less attention-grabbing.
This section contains practical examples of overriding the palette ofthe themes (Option for palette overrides). Users can copy the code totheir init file, evaluate it, and then re-load the theme for changesto take effect. To apply overrides at startup simply define thembefore the call that loads the theme. Remember that we also providepresets that are easier to apply (Palette override presets).
This is one of our practical examples to override the semantic colorsof the Modus themes (Stylistic variants using palette overrides). Tohide the border around the active and inactive mode lines, we need toset their color to that of the underlying background.
This is one of our practical examples to override the semantic colorsof the Modus themes (Stylistic variants using palette overrides).Here we show some snippets that apply different stylistic variants.Of course, it is possible to use theme-specific overrides to, say,have a blue mode line for modus-operandi and a red one formodus-vivendi.
This is one of our practical examples to override the semantic colorsof the Modus themes (Stylistic variants using palette overrides).Here we show how to affect the colors of the built-in tab-bar-modeand tab-line-mode.
df19127ead