Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve quotes for generic tokens #75

Merged
merged 4 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,18 @@ Follow the [Quickstart Guide](https://graphite.tilmangriesel.com/guides/getting-

[![Open Graphite in your Home Assistant instance](https://my.home-assistant.io/badges/hacs_repository.svg)](https://my.home-assistant.io/redirect/hacs_repository/?owner=TilmanGriesel&repository=graphite)


<details><summary>Or read the setup instructions here</summary>

#### Step 1: Install HACS

If you haven't already, [install HACS](https://hacs.xyz/docs/use/) by following the official guide.

#### Step 2: Add the Graphite Theme Repository

[Open Graphite in your Home Assistant HACS instance](https://my.home-assistant.io/redirect/hacs_repository/?owner=TilmanGriesel&repository=graphite)

##### Alternatively

1. Open the HACS interface in Home Assistant.
2. Search for **Graphite Theme** or use the direct link below:
3. Click **Install** to add the theme to your setup.
Expand All @@ -42,15 +43,16 @@ frontend:
```

#### Step 4: Restart Home Assistant

Restart your Home Assistant instance to apply changes.

#### Step 5: Select the Graphite Theme

1. Go to your **User Profile** in Home Assistant.
2. Under **Themes**, select `Graphite` (Light or Dark) from the dropdown menu.


### Manual Installation

For manual installation, you can follow these steps:

1. Download and copy the `themes` folder into your Home Assistant configuration directory.
Expand All @@ -67,21 +69,25 @@ For manual installation, you can follow these steps:
---

### Personalize Graphite
Customize the Graphite theme's primary color and more without needing to fork the project by using the [Graphite Theme Patcher](https://graphite.tilmangriesel.com/features/graphite-theme-patcher.html). This tool is designed for advanced users with technical expertise and experience in script and config modification. For detailed setup instructions, refer to the patcher's README.

Customize the Graphite theme's primary color and more without needing to fork the project by using the [Graphite Theme Patcher](https://graphite.tilmangriesel.com/features/graphite-theme-patcher.html). This tool is designed for advanced users with technical expertise and experience in script and config modification. For detailed setup instructions, refer to the patcher's documentation.

---

### Theme Development Kit

I've created a token abstraction and a script to help maintain Graphite's consistency across theme variants and simplify updates. This setup can also serve as a great starting point for building your own themes in no time. [Theme Development Kit](https://graphite.tilmangriesel.com/features/graphite-theme-development-kit.html)

---

### Examples

If you're curious about the cards from my screenshot, you can [check out my examples](https://graphite.tilmangriesel.com/guides/card-examples.html).

---

### Personal note

Hi there, I'm Tilman, nice to meet you! I'm a product designer and software engineer with a love for blending technology, art, design, and open-source projects. I live in a cozy 16th-century home that I'm gradually turning into a smarter, more connected space.

I started designing this theme in 2022 to make our smart home more intuitive and visually harmonious for my partner Sophia and me. The goal was to create an experience that's both user-friendly and aesthetically pleasing, without needing extra complexity or plugins.
Expand Down
48 changes: 34 additions & 14 deletions docs/features/graphite-theme-patcher.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Effortlessly customize Graphite's primary color and more **without forking the p
## Overview

The Graphite Theme Patcher allows you to:

- Adjust the primary accent color.
- Replace specific theme tokens for deeper customization.

Expand All @@ -16,7 +17,6 @@ This tool is ideal for tinkerers and power users familiar with script and config
Changes made with this patcher are **temporary**. Updates to the Graphite theme will overwrite customizations unless automated workflows are in place.
:::


## Installation

### **Step 1: Download the Patcher**
Expand All @@ -38,12 +38,11 @@ wget -O /config/scripts/graphite-theme-patcher.py https://raw.githubusercontent.

```yaml
shell_command:
patch_graphite_theme_primary_color: "python3 /config/scripts/graphite-theme-patcher.py {{ rgb_value }}"
patch_graphite_theme_primary_color: "python3 /config/scripts/graphite-theme-patcher.py --value '{{ rgb_value }}'"
```

3. Save and restart Home Assistant.


---

### **Step 3: Create a Home Assistant Script**
Expand Down Expand Up @@ -73,9 +72,9 @@ sequence:
- action: shell_command.patch_graphite_theme_primary_color
data:
rgb_value: "{{ user_primary_color | join(',') }}"
alias: Set Primary Color
- action: frontend.reload_themes
data: {}

```

## Usage
Expand All @@ -92,7 +91,7 @@ sequence:

## Advanced Customization

The basic installation outlined earlier will likely meet your needs, so you can stop here if you're satisfied. However, if you're ready to explore the patcher's true potential, consider this your gateway to experimentation and powerful customization. The documentation isn't exhaustive, but it equips you with enough knowledge to dive deep, experimenting with RGB and size tokens to unleash their full power. From here on, you're stepping into experimental, uncharted territory.
If your main goal was just to update the primary color, the earlier steps should do the trick. But if you're curious to see what else the patcher can do, this is your chance to experiment and customize to your heart’s content. The documentation isn't super detailed, but it gives you enough to start playing around with RGB and size tokens to see what's possible. From here, it's all about exploring and having fun in uncharted territory.

![graphite_theme_patcher_demo_advanced](/assets/gif/graphite_theme_patcher_demo_advanced.gif)

Expand All @@ -102,7 +101,7 @@ Add a new shell command to your `configuration.yaml`:

```yaml
shell_command:
patch_theme: "python3 /config/scripts/graphite-theme-patcher.py --theme {{ theme }} --token {{ token }} --type {{ type }} {{ value }}"
patch_theme: "python3 /config/scripts/graphite-theme-patcher.py --theme '{{ theme }}' --token '{{ token }}' --type '{{ type }}' --create --value '{{ value }}'"
```

Save and restart Home Assistant.
Expand Down Expand Up @@ -131,29 +130,50 @@ fields:
number:
min: 0
max: 100
step: 4
name: Large Radius
description: Choose your custom radius.
step: 3
name: "Large Radius "
description: Choose your custom large radius.
default: 18
required: true

sequence:
- action: update.install
target:
device_id: 510699c015423c5fe6211eccfc3fe364
data: {}
- action: shell_command.patch_theme
data:
theme: graphite
token: token-rgb-primary
type: rgb
value: "{{ user_primary_color | join(',') }}"
alias: Set Primary Color
- action: shell_command.patch_theme
data:
theme: graphite
token: token-size-radius-large
type: radius
value: "{{ user_radius_large }}"
alias: Set Radius
- action: shell_command.patch_theme
data:
theme: graphite
type: card-mod
token: card-mod-root
value: .header{display:none;}#view{padding:0!important;height:100vh!important;}
alias: Hide Header
enabled: false
- action: shell_command.patch_theme
data:
theme: graphite
type: card-mod
token: card-mod-root
value: .header{}
alias: Show Header
enabled: false
- action: shell_command.patch_theme
data:
theme: graphite
type: generic
token: my-token
value: url("/local/animated-icons/clear-night.svg")
alias: Set Custom Generic
enabled: false
- action: frontend.reload_themes
data: {}
```
Expand Down
Loading
Loading