Skip to content

Commit

Permalink
Homer now generates colorschemes from Xresources!
Browse files Browse the repository at this point in the history
  • Loading branch information
notthebee committed Dec 16, 2021
1 parent 1e09f75 commit e84469f
Show file tree
Hide file tree
Showing 39 changed files with 232 additions and 63 deletions.
19 changes: 19 additions & 0 deletions files/colorschemes/dracula
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
! Dracula Xresources palette
*.foreground: #F8F8F2
*.background: #282A36
*.color0: #282A36
*.color8: #4D4D4D
*.color1: #FF5555
*.color9: #FF6E67
*.color2: #50FA7B
*.color10: #5AF78E
*.color3: #F1FA8C
*.color11: #F4F99D
*.color4: #BD93F9
*.color12: #CAA9FA
*.color5: #FF79C6
*.color13: #FF92D0
*.color6: #8BE9FD
*.color14: #9AEDFE
*.color7: #BFBFBF
*.color15: #E6E6E6
36 changes: 36 additions & 0 deletions files/colorschemes/gruvbox
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
! -----------------------------------------------------------------------------
! File: gruvbox-dark.xresources
! Description: Retro groove colorscheme generalized
! Author: morhetz <[email protected]>
! Source: https://github.com/morhetz/gruvbox-generalized
! Last Modified: 6 Sep 2014
! -----------------------------------------------------------------------------

! hard contrast: *background: #1d2021
*background: #1d2021
! soft contrast: *background: #32302f
*foreground: #ebdbb2
! Black + DarkGrey
*color0: #282828
*color8: #928374
! DarkRed + Red
*color1: #cc241d
*color9: #fb4934
! DarkGreen + Green
*color2: #98971a
*color10: #b8bb26
! DarkYellow + Yellow
*color3: #d79921
*color11: #fabd2f
! DarkBlue + Blue
*color4: #458588
*color12: #83a598
! DarkMagenta + Magenta
*color5: #b16286
*color13: #d3869b
! DarkCyan + Cyan
*color6: #689d6a
*color14: #8ec07c
! LightGrey + White
*color7: #a89984
*color15: #ebdbb2
47 changes: 47 additions & 0 deletions files/colorschemes/nord
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
! Copyright (c) 2016-present Arctic Ice Studio <[email protected]>
! Copyright (c) 2016-present Sven Greb <[email protected]>

! Project: Nord XResources
! Version: 0.1.0
! Repository: https://github.com/arcticicestudio/nord-xresources
! License: MIT

#define nord0 #2E3440
#define nord1 #3B4252
#define nord2 #434C5E
#define nord3 #4C566A
#define nord4 #D8DEE9
#define nord5 #E5E9F0
#define nord6 #ECEFF4
#define nord7 #8FBCBB
#define nord8 #88C0D0
#define nord9 #81A1C1
#define nord10 #5E81AC
#define nord11 #BF616A
#define nord12 #D08770
#define nord13 #EBCB8B
#define nord14 #A3BE8C
#define nord15 #B48EAD

*.foreground: nord4
*.background: nord0
*.cursorColor: nord4
*fading: 35
*fadeColor: nord3

*.color0: nord1
*.color1: nord11
*.color2: nord14
*.color3: nord13
*.color4: nord9
*.color5: nord15
*.color6: nord8
*.color7: nord5
*.color8: nord3
*.color9: nord11
*.color10: nord14
*.color11: nord13
*.color12: nord9
*.color13: nord15
*.color14: nord7
*.color15: nord6
56 changes: 56 additions & 0 deletions files/colorschemes/solarized
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#define S_base03 #002b36
#define S_base02 #073642
#define S_base01 #586e75
#define S_base00 #657b83
#define S_base0 #839496
#define S_base1 #93a1a1
#define S_base2 #eee8d5
#define S_base3 #fdf6e3

*background: S_base03
*foreground: S_base0
*fadeColor: S_base03
*cursorColor: S_base1
*pointerColorBackground:S_base01
*pointerColorForeground:S_base1

#define S_yellow #b58900
#define S_orange #cb4b16
#define S_red #dc322f
#define S_magenta #d33682
#define S_violet #6c71c4
#define S_blue #268bd2
#define S_cyan #2aa198
#define S_green #859900

!! black dark/light
*color0: S_base02
*color8: S_base03

!! red dark/light
*color1: S_red
*color9: S_red

!! green dark/light
*color2: S_green
*color10: S_green

!! yellow dark/light
*color3: S_yellow
*color11: S_base00

!! blue dark/light
*color4: S_blue
*color12: S_base0

!! magenta dark/light
*color5: S_magenta
*color13: S_violet

!! cyan dark/light
*color6: S_cyan
*color14: S_base1

!! white dark/light
*color7: S_base2
*color15: S_base3
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions group_vars/all/vars.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ enable_pikvm: true

spindown_time: 600 # in seconds

colorscheme: nord
colorscheme: solarized

#
# Apt mirrors
Expand Down Expand Up @@ -291,7 +291,7 @@ snapraid_runner_command: "python3 {{ snapraid_runner_bin }} -c {{ snapraid_runne
# Stop all the docker containers, backup the {{ docker_dir }} to the MergerFS pool, execute the snapraid runner and start the containers back up
# Stopping the containers is necessary – backing up the data folder with the containers running will result in corrputed database files and no files can be changed during the Snapraid sync
snapraid_runner_cron_jobs:
- { job: 'docker stop $(docker ps -q) && rsync -avz --delete --exclude cache {{ docker_dir }} {{ mergerfs_root }}/docker_data && {{ snapraid_runner_command }} && docker start $(docker ps -a -q)', name: 'snapraid_runner', weekday: '0', hour: '3' }
- { job: 'docker stop $(docker ps -q) && rsync -avz --delete --exclude cache {{ docker_dir }} {{ mergerfs_root }}/docker_data & docker start $(docker ps -a -q) & {{ snapraid_runner_command }} ', name: 'snapraid_runner', weekday: '0', hour: '3' }

snapraid_runner_delete_threshold: 999999

Expand Down
4 changes: 3 additions & 1 deletion roles/containers/bitwarden/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ dashboard_url: "https://{{ subdomains['bitwarden'] }}.{{ host }}"

homer_category: services

dashboard_name: Bitwarden
dashboard_name: Bitwarden

health_url: "http://{{ ansible_default_ipv4.address }}:3000/https://{{ subdomains['bitwarden'] }}.{{ host }}"
2 changes: 2 additions & 0 deletions roles/containers/nextcloud/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ container_name: nextcloud

dashboard_url: "https://{{ subdomains['nextcloud'] }}.{{ host }}"

health_url: "http://{{ ansible_default_ipv4.address }}:3000/https://{{ subdomains['nextcloud'] }}.{{ host }}"

homer_category: services
1 change: 0 additions & 1 deletion roles/docker/vars/Debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ docker_deps:
- 'python3-pip'
- 'virtualenv'
- 'python3-setuptools'
- 'python3-pip'
- 'docker-compose'

docker_packages:
Expand Down
13 changes: 13 additions & 0 deletions roles/homer/files/custom.css
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
@charset "UTF-8";
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@300;400;600;700&display=swap');

body .no-footer #main-section {
background-color: rgba(0, 0, 0 , 0.15) !important;
display: flex;
flex-grow: 1;
}
body #app {
display: flex;
flex-direction: column;
}

footer {
display: none;
}
body, h1, h2, p, .title {
font-family: Open Sans !important;
font-weight: 400 !important;
Expand Down
14 changes: 7 additions & 7 deletions roles/homer/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
- name: Import the colorscheme variables
include_vars:
file: "vars/colorschemes/{{ colorscheme | lower }}.yml"
- name: Import Xresources variables
include_role:
name: xresources

- name: Print out
debug:
var: colors.color0

- name: Get a list of containers
delegate_to: localhost
Expand All @@ -21,10 +25,6 @@
name: "{{ item.path.split('/')[-1] }}"
with_items: "{{ containers.files }}"

- name: Print out
debug:
var: "{{ containers.files }}"

- name: Populate the dictionary of all containers
set_fact:
homer_urls: "{{ homer_urls | default([]) + [{ 'logo': '/assets/tools/homer-icons/' + item.path.split('/')[-1] + '.png', 'name': lookup('vars', item.path.split('/')[-1])['dashboard_name'] | default(item.path.split('/')[-1] | title), 'url' : lookup('vars', item.path.split('/')[-1])['dashboard_url'] | default(''), 'endpoint': lookup('vars', item.path.split('/')[-1])['health_url'] | default(''), 'category': lookup('vars', item.path.split('/')[-1])['homer_category'] | default ('') }] }}"
Expand Down
48 changes: 22 additions & 26 deletions roles/homer/templates/config.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,30 @@ connectivityCheck: true
theme: default
colors:
light:
highlight-primary: "{{ highlight_primary }}"
highlight-secondary: "{{ highlight_secondary }}"
highlight-hover: "{{ highlight_hover }}"
background: "{{ background }}"
card-background: "{{ card_background }}"
text: "{{ text }}"
text-header: "{{ text_header }}"
text-title: "{{ text_title }}"
text-subtitle: "{{ text_subtitle }}"
card-shadow: "{{ card_shadow }}"
link-hover: "{{ link_hover }}"
status-offline: "{{ status_offline }}"
status-online: "{{ status_online }}"
highlight-primary: "{{ colors.background }}"
highlight-secondary: "{{ colors.background }}"
highlight-hover: "{{ colors.background }}"
background: "{{ colors.background }}"
card-background: "{{ colors.color0 }}"
text: "{{ colors.color4 }}"
text-header: "{{ colors.color4 }}"
text-title: "{{ colors.foreground }}"
text-subtitle: "{{ colors.color15 }}"
status-offline: "{{ colors.color9 }}"
status-online: "{{ colors.color10 }}"

dark:
highlight-primary: "{{ highlight_primary }}"
highlight-secondary: "{{ highlight_secondary }}"
highlight-hover: "{{ highlight_hover }}"
background: "{{ background }}"
card-background: "{{ card_background }}"
text: "{{ text }}"
text-header: "{{ text_header }}"
text-title: "{{ text_title }}"
text-subtitle: "{{ text_subtitle }}"
card-shadow: "{{ card_shadow }}"
link-hover: "{{ link_hover }}"
status-offline: "{{ status_offline }}"
status-online: "{{ status_online }}"
highlight-primary: "{{ colors.background }}"
highlight-secondary: "{{ colors.color0 }}"
highlight-hover: "{{ colors.color0 }}"
background: "{{ colors.background }}"
card-background: "{{ colors.color0 }}"
text: "{{ colors.color4 }}"
text-header: "{{ colors.color4 }}"
text-title: "{{ colors.foreground }}"
text-subtitle: "{{ colors.color15 }}"
status-offline: "{{ colors.color9 }}"
status-online: "{{ colors.color10 }}"

services:
- name: "Media"
Expand Down
13 changes: 0 additions & 13 deletions roles/homer/vars/colorschemes/gruvbox.yml

This file was deleted.

13 changes: 0 additions & 13 deletions roles/homer/vars/colorschemes/nord.yml

This file was deleted.

25 changes: 25 additions & 0 deletions roles/xresources/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
---
- name: Install pip
package:
name: python3-pip
state: present

- name: Install the Xresources parser
pip:
name: xparser

- name: Install the Xresources file
copy:
dest: "/home/{{ username }}/.Xresources"
src: "files/colorschemes/{{colorscheme | lower }}"
owner: "{{ username }}"
group: "{{ username }}"

- name: Parse the Xresources file
shell:
cmd: "python3 -c 'import xrp; import json; result = xrp.parse_file(\"/home/{{ username }}/.Xresources\", encoding=\"utf8\"); print(json.dumps(dict(result.resources), indent = 4).replace(\"*.\", \"\").replace(\"*\", \"\"))'"
register: xresources

- name: Save variables
set_fact:
colors: "{{ xresources.stdout | from_json }}"

0 comments on commit e84469f

Please sign in to comment.