Skip to content

Commit

Permalink
Merge pull request #1 from stautonico/new-install
Browse files Browse the repository at this point in the history
2.0! New installer + custom new art!
  • Loading branch information
stautonico committed Jul 22, 2022
2 parents 5320e36 + 453e37a commit 5e9bc38
Show file tree
Hide file tree
Showing 6 changed files with 563 additions and 91 deletions.
54 changes: 42 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ people use it when their terminal opens. This is a modified/custom version of th
# Dependencies

- python3 (theoretically, this should work with python2, but I'm not actively testing that)
- pip
- requests (automatically installed if you don't have it)

# Installation

Expand All @@ -22,7 +24,6 @@ Installation is easy, just a simple one-liner.
wget -qO - https://raw.githubusercontent.com/stautonico/python-color-scripts/main/install.sh | sudo bash
```


# Updating

This script has a built-in updater.
Expand All @@ -40,6 +41,7 @@ If a new version exists, it will automatically install.
The simplest way to get started is just to type `python-colorscript` in your terminal to display a random artwork!

### Command Options

```shell
usage: python-colorscript [-h] [--16] [--256] [--left-padding LEFT_PADDING] [--top-padding TOP_PADDING] [--art ART]
[--list] [--random-color-mode] [--ignore-distro] [--blacklist BLACKLIST] [--version]
Expand All @@ -62,14 +64,16 @@ optional arguments:
--ignore-distro, -i Show distro specific artworks on all distros
--blacklist BLACKLIST, -b BLACKLIST
Remove specific artworks from random pool. Note: Multiple items need to be surrounded by quotes
--add-art Interactively add new art
--version, -V Show version information
--update Try to update to the latest version
--uninstall Uninstall the script from your system
```

and more secret arguments that you'll just have to discover on your own!

**Note that in the 8 and 16 color modes, your terminal's color scheme is used, which may result in strange-looking artwork
**Note that in the 8 and 16 color modes, your terminal's color scheme is used, which may result in strange-looking
artwork
depending on the colors you have set. For the "best" visual representation, use the 256 color mode by including `--256`
in your command**

Expand All @@ -85,39 +89,65 @@ To uninstall, simply:
sudo python-colorscript --uninstall
```

Note: Uninstalling does not remove `/etc/python-colorscript/art.json`, so manual changes will be saved next time you install. If you wish to remove it, you can manually do so after uninstalling.
Note: Uninstalling does not remove `~/.config/python-colorscript/`, so manual changes will be saved next time you install. If you wish to remove it, you can manually do so after uninstalling.

# Adding New Art

Since the printing of this art is all handled by kui's amazing [ANSI Pixels](https://kui.github.io/ansi_pixels) tool,
that is how you generate the art.
There are two ways to add new art: interactively and via a JSON file.

Regardless of the mode, you need to start by using kui's amazing [ANSI Pixels](https://kui.github.io/ansi_pixels) tool
to draw the art and get the base64 representation.

1. Navigate to [ANSI Pixels](https://kui.github.io/ansi_pixels)
2. Draw the art you want to be displayed (keep it to a smaller resolution because larger images will break on smaller
terminals)

Now the steps change depending on which method you use.

**If you want to edit the config file directly:**

3. Copy the link generated by the site (the text above the artwork that starts with "python -c")
4. Extract the base64 portion of the link (it is the part in quotes after "ansi-pixels.py)"
5. Add it to the `/etc/python-colorscript/art.json` file (use the existing artwork entries as a template)
4. Extract the base64 portion of the link (it is the part in quotes after "ansi-pixels.py or after the '#' in the URL
bar)"
5. Add it to the `~/.config/python-colorscript/art.json` file (use the existing artwork entries as a template)

Note: The format of `art.json` is as follows:

```json
{
"artwork_name": {
"8": "the base64 for the artwork in 8 color mode",
"16": "the base64 for the artwork in 16 color mode",
"256": "the base64 for the artwork in 256 color mode",
}
"artwork_name": {
"8": "the base64 for the artwork in 8 color mode",
"16": "the base64 for the artwork in 16 color mode",
"256": "the base64 for the artwork in 256 color mode"
}
}
```

Also, note that at least one color mode is required, but not all three need to be specified.

**Otherwise, you can launch the program with the `--add-art` flag**

5. Launch the program with the `--add-art` flag
6. Enter the name of the artwork and hit `Enter`
7. Enter the URL for the artwork in 8 color mode and hit `Enter`
8. Enter the URL for the artwork in 16 color mode and hit `Enter`
9. Enter the URL for the artwork in 256 color mode and hit `Enter`

You can add your art to this repo by submitting a pull request with your changes.

# Troubleshooting

### ZSH Completions Not Working

* Make sure `/usr/share/zsh/functions/Completion/Unix/_python-colorscript` exists
* Add `autoload -U compinit && compinit` to your `.zshrc`

### "command not found"

* Make sure you have `~/.local/bin` in your `$PATH` (the executable is installed here)
* Manually verify that `~/.local/bin/python-colorscript` exists and is executable
* Check with `stat ~/.local/bin/python-colorscript`

# Credits

Almost none of this is my original work, so all the credit belongs to these people:
Expand Down
3 changes: 2 additions & 1 deletion _python-colorscript
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ _arguments -S : \
"-l[Amount of space to add to the left side of the art]:int:" \
"--top-padding[Amount of space to add to the top of the art]:int:" \
"-t[Amount of space to add to the top of the art]:int:" \
"--art[Draw a specific piece of art. View all using --list]:model:(creeper blackmage questionmarkblock mushroom greenmushroom heart sus archbtw bunny egg menacing yinyang skull colorbars megaman debian manjaro android boo)" \
"--art[Draw a specific piece of art. View all using --list]:model:(<ARTWORKS>)" \
"--list[List the names of all available art pieces]" \
"--random-color-mode[Use a random color mode]" \
"-r[Use a random color mode]" \
"--not-sus[Guarantees you won't be the imposter]" \
"--ignore-distro[Show distro specific art on all distros]" \
"-i[Show distro specific art on all distros]" \
"--add-art[Interactively add new art]" \
"--blacklist[Remove specific artworks from random pool. Note: Multiple items need to be surrounded by quotes]" \
"-b[Remove specific artworks from random pool. Note: Multiple items need to be surrounded by quotes]" \
"--version[Show version information]" \
Expand Down
Loading

0 comments on commit 5e9bc38

Please sign in to comment.