Skip to content

Commit

Permalink
Personalize the appearance with custom colors and font settings
Browse files Browse the repository at this point in the history
* Add the ability to personalize the appearance with custom colors and font settings, but it is totally optional.
  • Loading branch information
endormi authored Dec 13, 2023
1 parent 8389285 commit 26498f5
Show file tree
Hide file tree
Showing 23 changed files with 363 additions and 152 deletions.
13 changes: 13 additions & 0 deletions .custom_settings.example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Default values
custom:
header_color: red
version_text_color: light_white
version_number_color: light_blue
author_color: light_white
link_color: light_white
prompt_text_color: light_white
prompt_color: light_yellow

# For Python logo tool
logo_color: red
logo_font: slant
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ and add the file to `docs/source/index.rst` `toctree`.

## Updating Docs

In the case you are updating `docs/source/commands.md`, `docs/source/packages.md`,
In the case you are updating `docs/source/guide.md`, `docs/source/packages.md`,
`GUIDE.md` and/or `PACKAGES.md`.
Changes must be made in `GUIDE.md` and/or `PACKAGES.md`.
Applying the changes also to `docs/source/` using `scripts/copy_content`.
Expand Down
7 changes: 2 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ RUN apt update \
clang-format \
&& apt clean

RUN git clone https://github.com/endormi/tilux.git \
&& cd tilux

COPY . ./
RUN git clone https://github.com/endormi/tilux.git .

ENV BUNDLER_VERSION=2.1.4

Expand All @@ -33,7 +30,7 @@ ENV BUNDLE_SILENCE_ROOT_WARNING=1 \
BUNDLE_APP_CONFIG="$GEM_HOME"

# Will install required packages and give permission for scripts
# When installing Python packages, it will give an warning:
# When installing Python packages, it will give a warning:
# Running pip as root will break packages and permissions.
# Since we're using a container, we don't need to worry about this.
RUN bash build y
Expand Down
84 changes: 81 additions & 3 deletions GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Guide

- [Commands to use](#commands)
- [Run from any folder](#run-from-any-folder)
- [Commands](#commands)
- [Running Individual Scripts](#running-individual-scripts)
- [Running with Docker](#running-with-docker)
- [Download script or scripts](#download-script-or-scripts)
- [Download Script or Scripts](#download-script-or-scripts)
- [Customize-Colors-and-Font](#customize-colors-and-font)

## Commands

Expand Down Expand Up @@ -188,3 +189,80 @@ wget -O - https://raw.githubusercontent.com/endormi/tilux/master/download/downlo

After downloading the scripts, you can add them to your `dotfiles` or
any other desired location.

## Customize Colors and Font

You can now personalize the appearance with custom colors and font settings.
To get started, create a new file named `.custom_settings.yaml`.

Here's an example of the file contents, derived from the
`.custom_settings.example.yaml` file, which provides default values:

```
# Default values
custom:
header_color: red
version_text_color: light_white
version_number_color: light_blue
author_color: light_white
link_color: light_white
prompt_text_color: light_white
prompt_color: light_yellow
# For Python logo tool
logo_color: red
logo_font: slant
```

You can customize your preferences by modifying the file `.custom_settings.yaml`
as shown below:

> **NOTE:** The provided example below has just a subset of the available
customization options. Feel free to explore and modify other values in the
`.custom_settings.yaml` file according to your preferences.
Refer to the default values for the full list of customization options.

```
custom:
header_color: blue
prompt_text_color: red
prompt_color: blue
logo_color: blue
logo_font: block
```

When creating the `.custom_settings.yaml` file, ensure it is not empty
to avoid errors. You can choose to customize specific values,
such as `header_color`, while leaving others to retain their
default color and font values.

### Supported Customizations

For the colors, `ANSI` foreground colors are supported. Utilize the following values:

> **NOTE:** To use light colors, simply prepend `light_`
to the color name, such as `light_red`.

```
black
red
green
yellow
blue
purple
cyan
white
```

For `logo_color` and `logo_font`, the options are drawn from `termcolor` and `FIGlet`.
Explore the available options for `logo_color` in the `termcolor`
[README.md](https://github.com/termcolor/termcolor#text-properties). The color options
provided here align with the earlier set values, with the only distinction being
the use of purple instead of magenta and some light colors.

For font options, refer to this [example site](http://www.figlet.org/examples.html)
showcasing various fonts.

Customize different configurations to find the perfect customization
that suits your preferences.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ deactivate

You can now use the `tilux` command:

> **NOTE:** Remember to `chmod +x tilux` before.
```bash
./tilux
```
Expand Down Expand Up @@ -177,7 +179,7 @@ tilux
```

> **NOTE**: `tilux` is not required to run scripts individually.
For more information, refer to [this section](GUIDE.md#run-from-any-folder)
For more information, refer to [this section](GUIDE.md#running-individual-scripts)
in the guide.

### Platform Compatibility
Expand All @@ -191,7 +193,7 @@ Pull requests for adding support for different distros are highly appreciated.
### Additional Information

To explore additional commands, learn how to run scripts from any folder, use Docker,
or download scripts, please refer to the [guide](GUIDE.md).
download scripts, or customize colors and font, please refer to the [guide](GUIDE.md).

For running the documentation locally, use the following command:

Expand Down
5 changes: 1 addition & 4 deletions build
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

green="\033[0;32m"
white="\033[1;37m"

version=$(cat .version)
text="Building Tilux v.$version"

Expand Down Expand Up @@ -64,4 +61,4 @@ pip3 install -r requirements.txt && bundle install
clear

echo "Note: Certain scripts might require you to install a package. It's included in the script."
echo -e "${green}Thanks for using Tilux!${white}\n"
echo -e "Thanks for using Tilux!\n"
84 changes: 78 additions & 6 deletions docs/source/commands.md → docs/source/guide.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,4 @@
# Commands

- [Commands to use](#commands)
- [Run from any folder](#run-from-any-folder)
- [Running with Docker](#running-with-docker)
- [Download script or scripts](#download-script-or-scripts)
# Guide

## Commands

Expand Down Expand Up @@ -188,3 +183,80 @@ wget -O - https://raw.githubusercontent.com/endormi/tilux/master/download/downlo

After downloading the scripts, you can add them to your `dotfiles` or
any other desired location.

## Customize Colors and Font

You can now personalize the appearance with custom colors and font settings.
To get started, create a new file named `.custom_settings.yaml`.

Here's an example of the file contents, derived from the
`.custom_settings.example.yaml` file, which provides default values:

```
# Default values
custom:
header_color: red
version_text_color: light_white
version_number_color: light_blue
author_color: light_white
link_color: light_white
prompt_text_color: light_white
prompt_color: light_yellow
# For Python logo tool
logo_color: red
logo_font: slant
```

You can customize your preferences by modifying the file `.custom_settings.yaml`
as shown below:

> **NOTE:** The provided example below has just a subset of the available
customization options. Feel free to explore and modify other values in the
`.custom_settings.yaml` file according to your preferences.
Refer to the default values for the full list of customization options.

```
custom:
header_color: blue
prompt_text_color: red
prompt_color: blue
logo_color: blue
logo_font: block
```

When creating the `.custom_settings.yaml` file, ensure it is not empty
to avoid errors. You can choose to customize specific values,
such as `header_color`, while leaving others to retain their
default color and font values.

### Supported Customizations

For the colors, `ANSI` foreground colors are supported. Utilize the following values:

> **NOTE:** To use light colors, simply prepend `light_`
to the color name, such as `light_red`.

```
black
red
green
yellow
blue
purple
cyan
white
```

For `logo_color` and `logo_font`, the options are drawn from `termcolor` and `FIGlet`.
Explore the available options for `logo_color` in the `termcolor`
[README.md](https://github.com/termcolor/termcolor#text-properties). The color options
provided here align with the earlier set values, with the only distinction being
the use of purple instead of magenta and some light colors.

For font options, refer to this [example site](http://www.figlet.org/examples.html)
showcasing various fonts.

Customize different configurations to find the perfect customization
that suits your preferences.
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ I have utilized multiple programming languages instead of just one.*
:caption: Contents:

usage
commands
guide
packages

Indices and tables
Expand Down
6 changes: 4 additions & 2 deletions docs/source/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ deactivate

You can now use the `tilux` command:

> **NOTE:** Remember to `chmod +x tilux` before.
```
./tilux
```
Expand Down Expand Up @@ -145,8 +147,8 @@ tilux
```

**NOTE**: `tilux` is not required to run scripts individually.
For more information, refer to #run-from-any-folder from
the commands section.
For more information, refer to #running-individual-scripts from
the guide section.

## Additional Information

Expand Down
1 change: 0 additions & 1 deletion scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ adding it to the system's `PATH`
- `groff` - Runs the manpage
- `install_req` - Installs required packages
- `latest_release` - Display latest release
- `list_of_files` - Display list of files in each language, because there are many
- `open_repo` - Opens tilux repository
- `resize_term` - Resizes terminal
- `run_sphinx_locally` - Run sphinx documentation locally
Expand Down
22 changes: 13 additions & 9 deletions scripts/copy_content
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@
./scripts/utils/check_and_install_package sed

docs_dir="docs/source"
copy_guide="GUIDE.md"
write_to_commands="$docs_dir/commands.md"
new_heading="# Commands"

cp $copy_guide $write_to_commands
sed -i "1 s/.*/$new_heading/" $write_to_commands
copy_pairs() {
cp "$1" "$docs_dir/$2"
}

copy_packages="packages.md"
uppercase_packages="$(tr '[:lower:]' '[:upper:]' <<< ${copy_packages:0:8})${copy_packages:8}"
file_pairs=(
"GUIDE.md guide.md"
"PACKAGES.md packages.md"
)

cp $uppercase_packages $docs_dir/$copy_packages
sed -i "$ d" $docs_dir/$copy_packages
for pair in "${file_pairs[@]}"; do
copy_pairs $pair
done

sed -i '2,7d' "$docs_dir/guide.md"
sed -i '30,31d' "$docs_dir/packages.md"
24 changes: 0 additions & 24 deletions scripts/list_of_files

This file was deleted.

4 changes: 2 additions & 2 deletions spec/color_names_spec.rb → spec/ansi_colors_spec.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require_relative '../tools/tilux/color_names'
require_relative '../tools/tilux/ansi_colors'

RSpec.describe ANSIColors do
let(:string) { 'Test String' }
Expand Down Expand Up @@ -76,7 +76,7 @@
describe '#white' do
it 'returns the string wrapped with the white color code' do
colored_string = string.white
expect(colored_string).to eq("\e[1;37mTest String\e[0m")
expect(colored_string).to eq("\e[37mTest String\e[0m")
end
end
end
Loading

0 comments on commit 26498f5

Please sign in to comment.