### Load Base16 Schemes with Python Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt Demonstrates how to load Base16 color schemes from YAML files using Python's PyYAML library. It includes functions to load the scheme and convert hex color codes to RGB tuples. ```python import yaml def load_scheme(filepath): """Load a Base16 color scheme from YAML file.""" with open(filepath, 'r') as f: scheme = yaml.safe_load(f) return scheme def hex_to_rgb(hex_color): """Convert hex color string to RGB tuple.""" hex_color = hex_color.lstrip('#') return tuple(int(hex_color[i:i+2], 16) for i in (0, 2, 4)) # Load the Spacemacs scheme scheme = load_scheme('spacemacs.yaml') print(f"Scheme: {scheme['scheme']}") print(f"Author: {scheme['author']}") # Access colors background = scheme['base00'] # "1f2022" foreground = scheme['base05'] # "a3a3a3" red = scheme['base08'] # "f2241f" # Convert to RGB for use in applications bg_rgb = hex_to_rgb(background) print(f"Background RGB: {bg_rgb}") # (31, 32, 34) # Output: # Scheme: Spacemacs # Author: Nasser Alshammari (https://github.com/nashamri/spacemacs-theme) # Background RGB: (31, 32, 34) ``` -------------------------------- ### Load Base16 Schemes with JavaScript/Node.js Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt Shows how to parse Base16 schemes in Node.js using the 'js-yaml' package. It includes functions to load schemes from files and convert hex colors to RGB objects, also demonstrating CSS variable generation. ```javascript const fs = require('fs'); const yaml = require('js-yaml'); function loadScheme(filepath) { const content = fs.readFileSync(filepath, 'utf8'); return yaml.load(content); } function hexToRgb(hex) { const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex); return result ? { r: parseInt(result[1], 16), g: parseInt(result[2], 16), b: parseInt(result[3], 16) } : null; } // Load OceanicNext scheme const scheme = loadScheme('oceanicnext.yaml'); console.log(`Loaded: ${scheme.scheme}`); // Generate CSS custom properties const cssVars = Object.entries(scheme) .filter(([key]) => key.startsWith('base')) .map(([key, value]) => ` --${key}: #${value};`) .join('\n'); console.log(`:root {\n${cssVars}\n}`); // Output: // Loaded: OceanicNext // :root { // --base00: #1B2B34; // --base01: #343D46; // --base02: #4F5B66; // --base03: #65737E; // --base04: #A7ADBA; // --base05: #C0C5CE; // --base06: #CDD3DE; // --base07: #D8DEE9; // --base08: #EC5f67; // --base09: #F99157; // --base0A: #FAC863; // --base0B: #99C794; // --base0C: #5FB3B3; // --base0D: #6699CC; // --base0E: #C594C5; // --base0F: #AB7967; // } ``` -------------------------------- ### Generate Xresources Terminal Configuration (Bash) Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt A bash script to convert Base16 YAML scheme files into the Xresources format for terminal emulators. It parses the scheme name and author from the YAML file. ```bash #!/bin/bash # generate-xresources.sh - Convert Base16 YAML to Xresources format SCHEME_FILE="$1" if [ -z "$SCHEME_FILE" ]; then echo "Usage: $0 " exit 1 fi # Parse YAML and generate Xresources echo "! Base16 scheme: $(grep 'scheme:' "$SCHEME_FILE" | cut -d'"' -f2)" echo "! Author: $(grep 'author:' "$SCHEME_FILE" | cut -d'"' -f2)" echo "" ``` -------------------------------- ### Extract and Format Colors for Xresources Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt A Bash script that iterates through Base16 color definitions in a YAML file and formats them into Xresources compatible syntax. It uses grep and awk to parse hex values and outputs them as *.colorN entries. ```bash for i in $(seq 0 15); do hex_i=$(printf '%X' $i) color=$(grep "base0${hex_i}:" "$SCHEME_FILE" | awk '{print $2}' | tr -d '"#') if [ -n "$color" ]; then echo "*.color${i}: #${color}" fi done ``` -------------------------------- ### Base16 Color Semantics Reference Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt A YAML-based mapping of Base16 color slots to their functional roles in UI and syntax highlighting. This structure ensures consistent theme application across different editors and terminals. ```yaml base00: "Background" base01: "Lighter Background" base02: "Selection Background" base03: "Comments" base04: "Dark Foreground" base05: "Default Foreground" base06: "Light Foreground" base07: "Lightest Foreground" base08: "Red - Variables" base09: "Orange - Constants" base0A: "Yellow - Classes" base0B: "Green - Strings" base0C: "Cyan - Support" base0D: "Blue - Functions" base0E: "Purple - Keywords" base0F: "Brown - Deprecated" ``` -------------------------------- ### Base16 Scheme File Structure (YAML) Source: https://context7.com/chriskempson/base16-unclaimed-schemes/llms.txt Defines the structure of a Base16 color scheme YAML file. It includes metadata like the scheme name and author, followed by 16 hexadecimal color values (base00 to base0F). ```yaml # Example: monokai.yaml scheme: "Monokai" author: "Wimer Hazenberg (http://www.monokai.nl)" base00: "272822" # Default Background base01: "383830" # Lighter Background (status bars) base02: "49483e" # Selection Background base03: "75715e" # Comments, Invisibles base04: "a59f85" # Dark Foreground (status bars) base05: "f8f8f2" # Default Foreground base06: "f5f4f1" # Light Foreground base07: "f9f8f5" # Lightest Foreground base08: "f92672" # Variables, XML Tags, Markup Link Text base09: "fd971f" # Integers, Boolean, Constants base0A: "f4bf75" # Classes, Markup Bold base0B: "a6e22e" # Strings, Inherited Class base0C: "a1efe4" # Support, Regular Expressions base0D: "66d9ef" # Functions, Methods base0E: "ae81ff" # Keywords, Storage base0F: "cc6633" # Deprecated, Embedded Language Tags ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.