Skip to content

Commit

Permalink
Rewrite of the configuration chapter. (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
wargio authored Feb 4, 2024
1 parent 8278c9c commit ff5227a
Show file tree
Hide file tree
Showing 20 changed files with 687 additions and 486 deletions.
3 changes: 2 additions & 1 deletion _quarto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ book:
- src/configuration/intro.md
- src/configuration/colors.md
- src/configuration/evars.md
- src/configuration/files.md
- src/configuration/initial_scripts.md
- src/configuration/build_variables.md

- part: "Basic Commands"
chapters:
Expand Down
138 changes: 0 additions & 138 deletions src/SUMMARY.md

This file was deleted.

2 changes: 1 addition & 1 deletion src/basic_commands/mapping_files.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Usage: o[?] # Open files and handle opened files

Prepare a simple layout:

```sh
```bash
$ rz-bin -l /bin/ls
[Linked libraries]
libselinux.so.1
Expand Down
33 changes: 33 additions & 0 deletions src/configuration/build_variables.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
## Build Variables

When rizin is built from sources, some build variables will be hardcoded within the rizin libraries.

These build variables can be accessed by executing the command `rizin -H` on a terminal.

```bash
$ rizin -H
RZ_VERSION=X.Y.Z
RZ_PREFIX=/usr
RZ_EXTRA_PREFIX=
RZ_MAGICPATH=/usr/share/rizin/magic
RZ_INCDIR=/usr/include/librz
RZ_LIBDIR=/usr/lib
RZ_SIGDB=/usr/share/rizin/sigdb
RZ_EXTRA_SIGDB=
RZ_LIBEXT=so
RZ_CONFIGHOME=/home/username/.config/rizin
RZ_DATAHOME=/home/username/.local/share/rizin
RZ_CACHEHOME=/home/username/.cache/rizin
RZ_LIB_PLUGINS=/usr/lib/rizin/plugins
RZ_EXTRA_PLUGINS=
RZ_USER_PLUGINS=/home/username/.local/lib/rizin/plugins
RZ_IS_PORTABLE=0
```

You can also view a specific build variable by executing `-H variable`.

For example:
```bash
$ rizin -H RZ_USER_PLUGINS
/home/username/.local/lib/rizin/plugins
```
44 changes: 25 additions & 19 deletions src/configuration/colors.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,38 @@
## Colors
## Colors & Themes

Console access is wrapped in API that permits to show the output of any command as ANSI, W32 Console or HTML formats. This allows rizin's core to run inside environments with limited displaying capabilities, like kernels or embedded devices. It is still possible to receive data from it in your favorite format.
The console access is encapsulated in an API that enables displaying the output of any command in ANSI, Win32 Console, or HTML formats. This functionality enables rizin to operate within environments with restricted display capabilities, such as kernels or embedded devices. You can still receive data from it in your preferred format.

To enable colors support by default, add a corresponding configuration option to the .rizin configuration file:
```
$ echo 'e scr.color=1' >> ~/.rizinrc
The color option is referred to as `scr.color` and can be modified using the `e` command. The `scr.color` option offers support for four values:
- `e scr.color=0`: no colors (black and white)
- `e scr.color=1`: ANSI colors (16 basic ANSI colors)
- `e scr.color=2`: 256 colors (256 scale colors)
- `e scr.color=3`: truecolor (24bit true color)

To change color support by default, include a corresponding configuration option in the `rizinrc` [initial script](initial_scripts.md).

For example:

```bash
# enable truecolor
$ echo "e scr.color=3" >> ~/.rizinrc
```
Note that enabling colors is not a boolean option. Instead, it is a number because there are different color depth levels. This is:

* 0: black and white
* 1: 16 basic ANSI colors
* 2: 256 scale colors
* 3: 24bit true color
The inclusion of user-defined options is necessary because there is no standardized or portable method for terminal programs to inquire about the console for optimal configurations. This also applies to charset encodings, so Rizin allows manual selection.

The reason for having such user-defined options is because there's no standard or portable way for the terminal programs to query the console to determine the best configuration, same goes for charset encodings, so rizin allows you to choose that by hand.
Typically, serial consoles may function well with options `0` (no colors) or `1` (ANSI), while more moderns terminals might support up to `3` (truecolor).

Usually, serial consoles may work with 0 or 1, while xterms may support up to 3. RCons will try to find the closest color scheme for your theme when you choose a different them with the `eco` command.
Rizin will attempt to discover the closest color scheme for your theme when selecting a theme using the `eco` command.

It is possible to configure the color of almost any element of disassembly output. For *NIX terminals, rizin accepts color specification in RGB format. To change the console color palette use `ec` command.
It is feasible to configure the color of nearly any element in the disassembly output. For UNIX-like terminals, Rizin accepts color specifications in `RGB` format. To alter the console color palette, use the `ec` command.

Type `ec` to get a list of all currently used colors. Type `ecs` to show a color palette to pick colors from:
- Type `ec` to get a list of all currently used colors.
- Type `ecs` to display a color palette to pick colors.
- Type `ecr` to randomize the color palette.

![img](rzpal.png)
![ecs command](ecs_palette.png)

## Themes

You can create your own color theme, but rizin have its own predefined ones. Use the `eco` command to list or select them.

After selecting one, you can compare between the color scheme of the shell and the current theme by pressing Ctrl-Shift and then right arrow key for the toggle.
You have the option to craft your custom color theme, although Rizin comes with its predefined ones. Utilize the `eco` command to view or choose from them (`eco <theme name>`).

In visual mode use the `R` key to randomize colors or choose the next theme in the list.
In visual panel mode (command `V`), you can switch themes by pressing `R` (`Shift + R`, or uppercase R). If you enable `scr.randpal` by setting it to `true`, you can randomize the palette similar to what `ecr` does.
File renamed without changes
Loading

0 comments on commit ff5227a

Please sign in to comment.