mirror of
https://github.com/danth/stylix
synced 2024-11-25 21:50:22 +00:00
149b313ddf
If the size is expressed as a string, Emacs calls bloody murder:
invalid font property (:size . "14.000000")
Fixes: 35233f9296
("emacs: explicitly set font size (#553)")
Reviewed-by: Jez Cope <jezcope@users.noreply.github.com>
Approved-by: NAHO <90870942+trueNAHO@users.noreply.github.com>
77 lines
2.5 KiB
Nix
77 lines
2.5 KiB
Nix
{ pkgs, config, lib, ... }:
|
|
|
|
with config.lib.stylix.colors.withHashtag;
|
|
with config.stylix.fonts;
|
|
|
|
let
|
|
emacsOpacity = builtins.toString (builtins.ceil (config.stylix.opacity.applications * 100));
|
|
emacsSize = builtins.toString (sizes.terminal * 1.0);
|
|
in
|
|
{
|
|
options.stylix.targets.emacs.enable =
|
|
config.lib.stylix.mkEnableTarget "Emacs" true;
|
|
|
|
config = lib.mkIf (config.stylix.enable && config.stylix.targets.emacs.enable) {
|
|
programs.emacs = {
|
|
extraPackages = epkgs:
|
|
[
|
|
(epkgs.trivialBuild {
|
|
pname = "base16-stylix-theme";
|
|
version = "0.1.0";
|
|
src = pkgs.writeText "base16-stylix-theme.el" ''
|
|
(require 'base16-theme)
|
|
|
|
(defvar base16-stylix-theme-colors
|
|
'(:base00 "${base00}"
|
|
:base01 "${base01}"
|
|
:base02 "${base02}"
|
|
:base03 "${base03}"
|
|
:base04 "${base04}"
|
|
:base05 "${base05}"
|
|
:base06 "${base06}"
|
|
:base07 "${base07}"
|
|
:base08 "${base08}"
|
|
:base09 "${base09}"
|
|
:base0A "${base0A}"
|
|
:base0B "${base0B}"
|
|
:base0C "${base0C}"
|
|
:base0D "${base0D}"
|
|
:base0E "${base0E}"
|
|
:base0F "${base0F}")
|
|
"All colors for Base16 stylix are defined here.")
|
|
|
|
;; Define the theme
|
|
(deftheme base16-stylix)
|
|
|
|
;; Add all the faces to the theme
|
|
(base16-theme-define 'base16-stylix base16-stylix-theme-colors)
|
|
|
|
;; Mark the theme as provided
|
|
(provide-theme 'base16-stylix)
|
|
|
|
;; Add path to theme to theme-path
|
|
(add-to-list 'custom-theme-load-path
|
|
(file-name-directory
|
|
(file-truename load-file-name)))
|
|
|
|
(provide 'base16-stylix-theme)
|
|
'';
|
|
packageRequires = [ epkgs.base16-theme ];
|
|
})
|
|
];
|
|
|
|
extraConfig = ''
|
|
;; ---- Generated by stylix ----
|
|
(require 'base16-stylix-theme)
|
|
(setq base16-theme-256-color-source 'colors)
|
|
(load-theme 'base16-stylix t)
|
|
;; Set font
|
|
(set-face-attribute 'default t :font (font-spec :family "${monospace.name}" :size ${emacsSize}))
|
|
;; -----------------------------
|
|
;; set opacity
|
|
(add-to-list 'default-frame-alist '(alpha-background . ${emacsOpacity}))
|
|
;; -----------------------------
|
|
'';
|
|
};
|
|
};
|
|
}
|