Giter Club home page Giter Club logo

base16-nix's Introduction

Base16 themes for home manager

This is a messy, personal set of scripts for managing colour schemes within hame manager. I am yet to share it because there are some unprincipled components likely to break (e.g. using sed to read yaml files), and because the build functions it introduces use sizable external dependencies.

I have found aspects of this very nice to use, and have tried to clean it up enough to be suitable for others to adapt. YMMV however.

Usage

N.b. this example roughly reflects my usage, but I haven't tried to use it directly, so there may be typos / bugs

{pkgs, lib, config, ...}:
{
  imports = [ ./base16.nix ];
  config = {

    # Choose your themee
    themes.base16 = {
      enable = true;
      scheme = "solarized";
      variant = "solarized-dark";

      # Add extra variables for inclusion in custom templates
      extraParams = {
        fontname = mkDefault  "Inconsolata LGC for Powerline";
        headerfontname = mkDefault  "Cabin";
        bodysize = mkDefault  "10";
        headersize = mkDefault  "12";
        xdpi= mkDefault ''
          Xft.hintstyle: hintfull
        '';
    };
    };

    # 1. Use pre-provided templates
    ###############################

    programs.bash.initExtra = ''
      source ${config.lib.base16.base16template "shell"}
    '';
    home.file.".vim/colors/mycolorscheme.vim".source =
      config.lib.base16.base16template "vim";

    # 2. Use your own templates
    ###########################

    home.file.".Xresources".source = config.lib.base16.template {
      src = ./examples/Xresources;
    };
    home.file.".xmonad/xmobarrc".source = config.lib.base16.template {
      src = ./examples/xmobarrc;
    };

    # 3. Template strings directly into other home-manager configuration
    ####################################################################

    services.dunst = {
        enable = true;
        settings = with config.lib.base16.theme;
            {
              global = {
                geometry         =  "600x1-800+-3";
                font             = "${headerfontname} ${headersize}";
                icon_path =
                  config.services.dunst.settings.global.icon_folders;
                alignment        = "right";
                frame_width      = 0;
                separator_height = 0;
                sort             = true;
              };
              urgency_low = {
                background = "#${base01-hex}";
                foreground = "#${base03-hex}";
              };
              urgency_normal = {
                background = "#${base01-hex}";
                foreground = "#${base05-hex}";
              };
              urgency_critical = {
                msg_urgency = "CRITICAL";
                background  = "#${base01-hex}";
                foreground  = "#${base08-hex}";
              };
        };
     };


  };
}

Reloading

Changing themes involves switching the theme definitoin and typing home-manager switch. There is no attempt in general to force programs to reload, and not all are able to reload their configs, although I have found that reloading xmonad and occasionally restarting applications has been enough.

You are unlikely to achieve a complet switch without logging out and logging back in again.

Todo

Provide better support for custom schemes (currently this assumes you'll want to use something in the base16 repositories, but there is no reason for this).

Updating Sources

cd into the directory in which the templates.yaml and schemes.yaml are located, and run update_sources.sh

base16-nix's People

Contributors

atpotts avatar u-quark avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.