Skip to content

Commit

Permalink
lint: Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
elvis kahoro committed Jun 21, 2023
1 parent 6008ba3 commit cfadbc7
Show file tree
Hide file tree
Showing 79 changed files with 583 additions and 620 deletions.
6 changes: 2 additions & 4 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

## Discord username (optional)

If you're in our Discord server, we'd like to give you the Contributor Discord Role, please include
your username. Note: It must be labelled like so: username#4747 (make sure to include the #XXXX).
If you're in our Discord server, we'd like to give you the Contributor Discord Role, please include your username. Note: It must be labelled like so: username#4747 (make sure to include the #XXXX).

## Name of theme

Expand All @@ -20,5 +19,4 @@ We cannot accept pull request that include custom background images because:
- of licensing restrictions
- we are trying to keep the binary size of the repo as small as possible (just the yaml files)

If your theme has an intended custom background image, include a comment in the yaml with a link to
where people should download it.
If your theme has an intended custom background image, include a comment in the yaml with a link to where people should download it.
1 change: 1 addition & 0 deletions .trunk/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
plugins
user_trunk.yaml
user.yaml
shims
2 changes: 1 addition & 1 deletion .trunk/config
Submodule config updated 1 files
+72 −0 ruff.toml
19 changes: 10 additions & 9 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
version: 0.1
cli:
version: 1.0.1
version: 1.11.0
plugins:
sources:
- id: trunk
ref: v0.0.5
ref: v0.0.14
uri: https://github.com/trunk-io/plugins
lint:
enabled:
- isort@5.12.0
- prettier@2.8.8
- black@23.3.0
- gitleaks@8.17.0
- markdownlint@0.35.0
- flake8@6.0.0
- svgo@3.0.2
disabled:
- git-diff-check
- isort@5.10.1
- prettier@2.7.1
- black@22.10.0
- gitleaks@8.15.0
- markdownlint@0.32.2
- flake8@5.0.4
- svgo@3.0.0
runtimes:
enabled:
- go@1.18.3
Expand Down
42 changes: 13 additions & 29 deletions README-intro.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
# Warp Themes

This is an open source repository with themes for [Warp](https://www.warp.dev/). We welcome and
appreciate any contributions! Join our [Discord](https://discord.gg/warpdotdev), we have a channel
dedicated to discussing custom themes.
This is an open source repository with themes for [Warp](https://www.warp.dev/). We welcome and appreciate any contributions! Join our [Discord](https://discord.gg/warpdotdev), we have a channel dedicated to discussing custom themes.

We have
[directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes)
We have [directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes)

## Custom Background Images

Warp supports setting background images, set the path to your background image in your themes
`.yaml` file:
Warp supports setting background images, set the path to your background image in your themes `.yaml` file:

- a relative path to `~/.warp/themes`
- the absolute path to the background image

If your background image was under `~/.warp/themes/level_one/level_two/background_image.jpg` then
the filepath in the yaml should be:
If your background image was under `~/.warp/themes/level_one/level_two/background_image.jpg` then the filepath in the yaml should be:

```yaml
background_image:
Expand All @@ -25,21 +20,17 @@ background_image:
## Contributing
tldr; After adding your theme run the python script for generating theme previews
`./scripts/gen_theme_previews.py` like so:
tldr; After adding your theme run the python script for generating theme previews `./scripts/gen_theme_previews.py` like so:

`python3 ./scripts/gen_theme_previews.py standard`

For a newly added theme that's in the standard folder / directory. If you get the error that yaml is
missing make sure you `pip install PyYAML`
For a newly added theme that's in the standard folder / directory. If you get the error that yaml is missing make sure you `pip install PyYAML`

There are more
[directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes).
There are more [directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes).

## Open source dependencies

We'd like to call out a few of the open source themes and repositories that helped bootstrap the set
of themes for Warp:
We'd like to call out a few of the open source themes and repositories that helped bootstrap the set of themes for Warp:

- [iTerm colors pencil](https://github.com/mattly/iterm-colors-pencil)
- [Alacritty-theme](https://github.com/eendroroy/alacritty-theme)
Expand All @@ -51,21 +42,14 @@ of themes for Warp:

## What are base16 themes?

> An architecture for building themes based on carefully chosen syntax highlighting using a base of
> sixteen colors. Base16 provides a set of guidelines detailing how to style syntax and how to code
> a builder for compiling Base16 schemes and templates.
> An architecture for building themes based on carefully chosen syntax highlighting using a base of sixteen colors. Base16 provides a set of guidelines detailing how to style syntax and how to code a builder for compiling Base16 schemes and templates.

More on the details and structure here:
[https://github.com/chriskempson/base16.](https://github.com/chriskempson/base16)
More on the details and structure here: [https://github.com/chriskempson/base16.](https://github.com/chriskempson/base16)

Base16 themes were sourced and auto-generated based on the Alacritty themes collected by @aarowill.
Repo: [https://github.com/aarowill/base16-alacritty](https://github.com/aarowill/base16-alacritty)
Base16 themes were sourced and auto-generated based on the Alacritty themes collected by @aarowill. Repo: [https://github.com/aarowill/base16-alacritty](https://github.com/aarowill/base16-alacritty)

## What are standard themes?

In this directory you'll find themes popular among other tools, including Solarized, Dracula and
others.
In this directory you'll find themes popular among other tools, including Solarized, Dracula and others.

Themes in this directory were sourced and auto-generated based on the Alacritty themes collected by
@eendroroy. Repo:
[https://github.com/eendroroy/alacritty-theme](https://github.com/eendroroy/alacritty-theme)
Themes in this directory were sourced and auto-generated based on the Alacritty themes collected by @eendroroy. Repo: [https://github.com/eendroroy/alacritty-theme](https://github.com/eendroroy/alacritty-theme)
48 changes: 14 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,21 @@
# Warp Themes

This is an open-source repository with themes for [Warp](https://www.warp.dev/). We welcome and
appreciate any contributions! Join our [Discord](https://discord.gg/warpdotdev), we have a channel
dedicated to discussing custom themes.
This is an open-source repository with themes for [Warp](https://www.warp.dev/). We welcome and appreciate any contributions! Join our [Discord](https://discord.gg/warpdotdev), we have a channel dedicated to discussing custom themes.

We have
[directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes/custom-themes)
We have [directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes/custom-themes)

## Create your own theme with Warp-Themes.com

[Warp-Themes.com](https://warp-themes.com/) is a web app built entirely by community member
[Torben Haack](https://twitter.com/torben_haack). The tool allows you to visually customize your own
terminal theme with a few simple color selections, then download that theme file and have Warp load
it into its theme picker. Please see more on how to use the app in our
[Warp-Themes blog post](https://www.warp.dev/blog/create-custom-terminal-theme).
[Warp-Themes.com](https://warp-themes.com/) is a web app built entirely by community member [Torben Haack](https://twitter.com/torben_haack). The tool allows you to visually customize your own terminal theme with a few simple color selections, then download that theme file and have Warp load it into its theme picker. Please see more on how to use the app in our [Warp-Themes blog post](https://www.warp.dev/blog/create-custom-terminal-theme).

## Custom Background Images

Warp supports setting background images, set the path to your background image in your themes
`.yaml` file:
Warp supports setting background images, set the path to your background image in your themes `.yaml` file:

- A relative path to `~/.warp/themes/background.jpg`
- The absolute path to the background image `/Users/my_user/Documents/background.jpg`

If your background image was under `~/.warp/themes/level_one/level_two/background_image.jpg` then
the file path in the yaml should be:
If your background image was under `~/.warp/themes/level_one/level_two/background_image.jpg` then the file path in the yaml should be:

```yaml
background_image:
Expand All @@ -34,21 +25,17 @@ background_image:
## Contributing
TLDR; After adding your theme run the python script for generating theme previews
`./scripts/gen_theme_previews.py` like so:
TLDR; After adding your theme run the python script for generating theme previews `./scripts/gen_theme_previews.py` like so:

`python3 ./scripts/gen_theme_previews.py standard`

for a newly added theme that's in the standard folder/directory. If you get the error that yaml is
missing make sure you `pip install PyYAML`
for a newly added theme that's in the standard folder/directory. If you get the error that yaml is missing make sure you `pip install PyYAML`

There are more
[directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes).
There are more [directions on how to use this repository in our documentation.](https://docs.warp.dev/features/themes).

## Open source dependencies

We'd like to call out a few of the open source themes and repositories that helped bootstrap the set
of themes for Warp:
We'd like to call out a few of the open source themes and repositories that helped bootstrap the set of themes for Warp:

- [iTerm colors pencil](https://github.com/mattly/iterm-colors-pencil)
- [Alacritty-theme](https://github.com/alacritty/alacritty-theme)
Expand All @@ -60,24 +47,17 @@ of themes for Warp:

## What are base16 themes?

> An architecture for building themes based on carefully chosen syntax highlighting using a base of
> sixteen colors. Base16 provides a set of guidelines detailing how to style syntax and how to code
> a builder for compiling Base16 schemes and templates.
> An architecture for building themes based on carefully chosen syntax highlighting using a base of sixteen colors. Base16 provides a set of guidelines detailing how to style syntax and how to code a builder for compiling Base16 schemes and templates.

More on the details and structure here:
[https://github.com/chriskempson/base16.](https://github.com/chriskempson/base16)
More on the details and structure here: [https://github.com/chriskempson/base16.](https://github.com/chriskempson/base16)

Base16 themes were sourced and auto-generated based on the Alacritty themes collected by @aarowill.
Repo: [https://github.com/aarowill/base16-alacritty](https://github.com/aarowill/base16-alacritty)
Base16 themes were sourced and auto-generated based on the Alacritty themes collected by @aarowill. Repo: [https://github.com/aarowill/base16-alacritty](https://github.com/aarowill/base16-alacritty)

## What are standard themes?

In this directory, you'll find themes popular among other tools, including Solarized, Dracula, and
others.
In this directory, you'll find themes popular among other tools, including Solarized, Dracula, and others.

Themes in this directory were sourced and auto-generated based on the Alacritty themes collected by
@eendroroy. Repo:
[https://github.com/eendroroy/alacritty-theme](https://github.com/eendroroy/alacritty-theme)
Themes in this directory were sourced and auto-generated based on the Alacritty themes collected by @eendroroy. Repo: [https://github.com/eendroroy/alacritty-theme](https://github.com/eendroroy/alacritty-theme)

## What are holiday themes?

Expand Down
74 changes: 37 additions & 37 deletions scripts/gen_theme_previews.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,14 @@
import os
from pathlib import Path
from typing import Any
from typing import Dict
from typing import List
from typing import Optional

import yaml


def get_all_input_files(input_dir: str) -> List[str]:
"""
Parameters
def get_all_input_files(
input_dir: str,
) -> list[str]:
"""Parameters
----------
input_dir :
Expand All @@ -21,13 +18,13 @@ def get_all_input_files(input_dir: str) -> List[str]:
"""
filenames: Any = next(os.walk(input_dir), (None, None, []))[2]
return list(filter(lambda f: (f.endswith("yaml") or f.endswith("yml")), filenames))
return list(filter(lambda f: (f.endswith(("yaml", "yml"))), filenames))


def ensure_output_dir(output_dir: str) -> None:
"""
Parameters
def ensure_output_dir(
output_dir: str,
) -> None:
"""Parameters
----------
output_dir :
"""
Expand All @@ -36,14 +33,12 @@ def ensure_output_dir(output_dir: str) -> None:


def add_color_to_dict(
output: Dict[str, str],
obj: Dict[str, str],
output: dict[str, str],
obj: dict[str, str],
key: str,
prefix: Optional[str] = None,
prefix: str | None = None,
) -> None:
"""
Parameters
"""Parameters
----------
output :
obj :
Expand All @@ -55,10 +50,11 @@ def add_color_to_dict(
output[f"{prefix}{key}"] = obj[key]


def get_color_dict(input_dir: str, file_name: str) -> Dict[str, str]:
"""
Parameters
def get_color_dict(
input_dir: str,
file_name: str,
) -> dict[str, str]:
"""Parameters
----------
input_dir :
file_name :
Expand All @@ -67,28 +63,28 @@ def get_color_dict(input_dir: str, file_name: str) -> Dict[str, str]:
-------
"""
file = open(os.path.join(input_dir, file_name), "r")
file = open(os.path.join(input_dir, file_name))
loaded_theme = yaml.safe_load(file)
output: Dict[str, str] = {}
output: dict[str, str] = {}
add_color_to_dict(output, loaded_theme, "accent")
add_color_to_dict(output, loaded_theme, "foreground")
add_color_to_dict(output, loaded_theme, "background")

normal_colors = loaded_theme["terminal_colors"]["normal"]
for color in normal_colors.keys():
for color in normal_colors:
add_color_to_dict(output, normal_colors, color)

bright_colors = loaded_theme["terminal_colors"]["bright"]
for color in bright_colors.keys():
for color in bright_colors:
add_color_to_dict(output, bright_colors, color, "br")

return output


def file_name_to_display(file_name: str) -> str:
"""
Parameters
def file_name_to_display(
file_name: str,
) -> str:
"""Parameters
----------
file_name :
Expand All @@ -105,10 +101,11 @@ def file_name_to_display(file_name: str) -> str:
return " ".join(output)


def gen_svg_for_theme(color_dict: Dict[str, str], svg_template: str) -> str:
"""
Parameters
def gen_svg_for_theme(
color_dict: dict[str, str],
svg_template: str,
) -> str:
"""Parameters
----------
color_dict :
svg_template :
Expand All @@ -128,15 +125,18 @@ def gen_svg_for_theme(color_dict: Dict[str, str], svg_template: str) -> str:
def main() -> None:
""" """
parser = argparse.ArgumentParser(
description="Generate README.md with embedded SVG previews."
description="Generate README.md with embedded SVG previews.",
)
parser.add_argument(
"input_dir",
type=str,
help="Directory from which to read in all Warp themes.",
)
parser.add_argument(
"--output_dir", type=str, help="Where to save README.md", default=""
"--output_dir",
type=str,
help="Where to save README.md",
default="",
)
parser.add_argument(
"--svg_path",
Expand All @@ -161,7 +161,7 @@ def main() -> None:

filenames = get_all_input_files(input_dir=input_dir)
markdown = ["|Theme name | Preview|", "| --- | --- |"]
svg = open(args.svg_path, "r").read()
svg = open(args.svg_path).read()
svg_dir = os.path.join(output_dir, "previews")
os.makedirs(svg_dir, exist_ok=True)

Expand Down
Loading

0 comments on commit cfadbc7

Please sign in to comment.