diff options
author | Canop <cano.petrole@gmail.com> | 2024-04-28 09:13:54 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2024-04-28 09:13:54 +0200 |
commit | 6c8920837ca4ee1625d39022a838a6f4010370dc (patch) | |
tree | 4bb5708824d4584b0db4d75575d26805ab16006f | |
parent | a9650d0e86e23baa37e2e94f5a9cb26be102eae2 (diff) | |
parent | f8dacb33bfc57dc544883d795de8cd386cb3349d (diff) |
Merge branch 'patch-1' of github.com:asdf8dfafjk/broot into asdf8dfafjk-patch-1
-rw-r--r-- | resources/default-conf/skins/native-16.hjson | 132 | ||||
-rw-r--r-- | website/docs/icons.md | 139 |
2 files changed, 190 insertions, 81 deletions
diff --git a/resources/default-conf/skins/native-16.hjson b/resources/default-conf/skins/native-16.hjson new file mode 100644 index 0000000..a220c10 --- /dev/null +++ b/resources/default-conf/skins/native-16.hjson @@ -0,0 +1,132 @@ +############################################################### +# 16 ANSI color theme. Colors in this theme are restricted from +# ANSI color 0 - 15. This will allow the theme to adapt to your +# terminal emulator's theme. Note that, for now, the preview +# mode does not yet support this theme because of syntect not +# having a 16 ansi color theme. +# +# More info at https://jeffkreeftmeijer.com/vim-16-color/ +# Doc at https://dystroy.org/broot/skins/ +############################################################### + +skin: { + directory: ansi(12) + file: ansi(7) + pruning: ansi(8) none italic + selected_line: none ansi(0) + tree: ansi(8) + + # Search + char_match: ansi(3) none underlined + parent: ansi(4) none bold + + # File properties + exe: ansi(2) + link: ansi(13) + sparse: ansi(12) + + # Prompt + input: ansi(6) + + # Status bar + status_bold: ansi(7) ansi(8) bold + status_code: ansi(10) ansi(8) + status_ellipsis: ansi(7) ansi(8) + status_error: ansi(7) ansi(8) + status_italic: ansi(7) ansi(8) italic + status_job: ansi(7) ansi(8) + status_normal: ansi(7) ansi(8) + + # Flag status + flag_label: ansi(6) + flag_value: ansi(14) none bold + + # Background + default: none none + + # Scrollbar + scrollbar_track: ansi(0) + scrollbar_thumb: ansi(3) + + # Git + git_branch: ansi(13) + git_deletions: ansi(1) + git_insertions: ansi(2) + git_status_conflicted: ansi(1) + git_status_current: ansi(6) + git_status_ignored: ansi(8) + git_status_modified: ansi(3) + git_status_new: ansi(2) none bold + git_status_other: ansi(5) + + # Staging area + staging_area_title: ansi(3) + + # Documentation + help_bold: ansi(7) none bold + help_code: ansi(4) + help_headers: ansi(3) + help_italic: ansi(7) none italic + help_paragraph: ansi(7) + help_table_border: ansi(8) + + # Device column + device_id_major: ansi(5) + device_id_minor: ansi(5) + device_id_sep: ansi(5) + + # Counts column + count: ansi(13) + + # Dates column + dates: ansi(6) + + # Permissions column + group: ansi(3) + owner: ansi(3) + perm__: ansi(8) + perm_r: ansi(3) + perm_w: ansi(1) + perm_x: ansi(2) + + # Hex preview + hex_null: ansi(8) + hex_ascii_graphic: ansi(2) + hex_ascii_whitespace: ansi(3) + hex_ascii_other: ansi(4) + hex_non_ascii: ansi(5) + + # Preview + # preview: none + # preview_line_number: none + # preview_match: none + # preview_title: none + + # Used for displaying errors + file_error: ansi(1) + + # Content searches + content_extract: ansi(7) + content_match: ansi(3) none underlined + + # Used in status line + purpose_bold: ansi(0) ansi(7) bold + purpose_ellipsis: ansi(0) + purpose_italic: ansi(0) ansi(7) italic + purpose_normal: ansi(0) + + # Modal indicator + mode_command_mark: ansi(7) ansi(4) + + # File system occupation + good_to_bad_0: ansi(2) + good_to_bad_1: ansi(2) + good_to_bad_2: ansi(2) + good_to_bad_3: ansi(2) + good_to_bad_4: ansi(2) + good_to_bad_5: ansi(1) + good_to_bad_6: ansi(1) + good_to_bad_7: ansi(1) + good_to_bad_8: ansi(1) + good_to_bad_9: ansi(1) +} diff --git a/website/docs/icons.md b/website/docs/icons.md index 7010645..49dc868 100644 --- a/website/docs/icons.md +++ b/website/docs/icons.md @@ -1,9 +1,15 @@ # Icons Overview -You may configure broot to display icons in two ways. +Broot supports showing icons in terminal if a supported font is installed. +Currently, two fonts are supported, `nerdfonts` and `vscode`. -For this you need one of those in your broot config: +Here is a screenshot, with nerdfont to the left and vscode at right: +![Broot icon comparison](img/20240225-icon-comparison.png) + +# Configuration + +First add the appropriate lines to your broot config. ```hjson icon_theme: vscode @@ -21,127 +27,98 @@ icon_theme: nerdfont icon_theme = "nerdfont" ``` +If the appropriate fonts are already installed correctly on your system then new instances of broot will show icons correctly. -Here is a comparison, with nerdfont to the left and vscode at right: - -![Broot icon comparison](img/20240225-icon-comparison.png) - -# Nerdfont Icons: - -## Installation - -1. In order for the nerdfont setting to work you need to have a <a href="https://github.com/ryanoasis/nerd-fonts" target="_blank">patched nerdfont -</a> installed and set as your font in the terminal emulator of your choice. -2. After a successful installation, you need to add or uncomment the `icon_theme: "nerdfont"` line in broot's config file -3. You should now be able to see icons when opening broot in your terminal. +# Installation and checking for presence ## Checking the font -If you want to make sure your nerdfont was installed correctly. Try printing out the utf code for the rust icon in your terminal: +### VSCode -### Bash (and compatible): +#### Bash (and compatible): ```bash -echo -e "file_type_rust looks like \ue7a8" +echo -e "file_type_rust looks like \U001002D2" ``` -This should display a rust icon +#### powershell -## FAQ - -**Q:** I don't see icons for my favourite common file type. - -**A:** There could be three reasons why you don't see your file type icon - -1. check if your font was setup correctly. See [Installation](icons.md#minstallation) and #checking the font -2. The iconset is limited by available nerdfont icons. Some icons simply don't exist as of yet. - Eg. a vite or prettier icon. You can find available icons in the nerdfont [cheat-sheet](https://www.nerdfonts.com/cheat-sheet) -3. If both of those are true and you think you found an icon we mapped wrong or is missing, we welcome your contribution! Send us a message in the [Miaou chat](https://miaou.dystroy.org/3490?broot) or create a pull request - -**Q:** Why does broot show a generic icon for this very common file type? - -**A:** The icon mappings aren't complete. You can help out very easily without any coding knowledge. Go to the github repository. Enter the directory corresponding to your theme. Inside data, edit extension_to_icon_name_map.rs and add a line corresponding to your extension. The first field would be the extensions you would like, and the second field should be referred from icon_name_to_icon_code_point_map.rs. Submit a PR. - -**Q:** Can I set up a totally different set of icons or mappings ? - -**A:** Broot can be configured for a different mapping or a different font, but this needs some coding and a new compilation. -To get started, have a look at look at the resources/icons/nerdfont directory and, if necessary, come and chat on miaou. +```powershell +echo "Rust is `u{1002D2}" +``` +If you see a rust gear icon, your terminal is displaying the correct font. -If you want to map or remap icons, please go to <a href="https://www.nerdfonts.com/cheat-sheet" target="_blank">nerdfont-cheat-sheet</a> and search for an icon you would like to set in its place. -In order to correctly fix the icon mapping you need a FILE_EXTENSION and a NERDFONT_ICON_CODE. For this example we are remapping the json file extension. +### Nerdfont -The first thing you need to do is find the "json" icon you want to map to in the cheatsheet and copy its iconCode ("the code inside the red box in the screenshot below"). -Once done, find the corresponding file mapping in resources/icons/nerdfont by searching for your filetype in icon_name_to_icon_code_point_map: -In this case its this line: -``` -( "file_type_json", 0xe60b ), +#### Bash (and compatible): +```bash +echo -e "file_type_rust looks like \ue7a8" ``` -As you can see: the icon is mapped by "0x" followed by your iconCode. After changing this you should be able to recompile broot and see your new icon. If this is a new file mapping or a missing icon. Please consider contributing! +This should display a rust icon -![nerdfont cheatsheet iconCode](img/20240225-nerdfont-cheatsheet.png) +Unless you're really unlucky (there is some font that has the rust gear icon at the exact unicode point as the query but doesn't have other glyphs), you probably have the font installed correctly. If not, move to the installation section. -# Vscode Icons: +## Installation -## Checking the font +### VSCode -This feature needs the vscode font to be installed and available on your system. +If the font isn't installed, you may -It's possible the font was installed with broot's package, depending on the chosen package. +* take it from `/resources/icons/vscode/vscode.ttf` if you have broot sources +* download it from [https://github.com/Canop/broot/blob/main/resources/icons/vscode/vscode.ttf](https://github.com/Canop/broot/blob/main/resources/icons/vscode/vscode.ttf), +* or take it from the release archive if you installed broot from its zipped archive. -Here's how you can check its presence: +#### Installation on linux: -### Bash (and compatible): -```bash -echo -e "file_type_rust looks like \U001002D2" -``` +Copy the `vscode.ttf` file to `~/.local/share/fonts`. -### powershell +#### Installation on Windows -```powershell -echo "Rust is `u{1002D2}" -``` -If you see a rust gear icon, your terminal is displaying the correct font. +Double click the `vscode.ttf` file icon and click on "Install font". -## Setting up the font -If the font isn't installed, you may +### Nerdfonts -* take it in `/resources/icons/vscode/vscode.ttf` if you have broot sources -* download it from [https://github.com/Canop/broot/blob/main/resources/icons/vscode/vscode.ttf](https://github.com/Canop/broot/blob/main/resources/icons/vscode/vscode.ttf), -* or take it in the release archive if you installed broot from its zipped archive. +1. In order for the nerdfont setting to work you need to have a <a href="https://github.com/ryanoasis/nerd-fonts" target="_blank">patched nerdfont +</a> installed and set as your font in the terminal emulator of your choice. +2. After a successful installation, you need to add or uncomment the `icon_theme: "nerdfont"` line in broot's config file +3. You should now be able to see icons when opening broot in your terminal. -### Installation on linux: -Copy the `vscode.ttf` file to `~/.local/share/fonts`. -### Installation on Windows +## FAQ -Double click the `vscode.ttf` file icon and click on "Install font". +**Q:** Why does broot show a generic icon for this very common file type? -## Setting up your broot config +**A:** The icon mappings aren't complete. You can help out very easily without any coding knowledge. Go to the github [repository](https://github.com/Canop/broot/tree/main/resources/icons). Enter the directory corresponding to your theme. Inside `data`, edit `extension_to_icon_name_map.rs` and add a line corresponding to your extension. The first field would be the extensions you would like, and the second field should be referred from `icon_name_to_icon_code_point_map.rs`. Submit a PR. -In broot's config file, add or uncomment the `icon_theme: "vscode"` line. +**Q:** Can I set up a totally different set of icons or mappings ? -## FAQ +**A:** Broot can be configured for a different mapping or a different font, but this needs some coding and a new compilation. +To get started, have a look at look at the resources/icons/nerdfont directory and, if necessary, come and chat on miaou. -**Q:** I don't see icons for my favourite common file type. -**A:** This is a work in progress, you can help out +**Q:** Why isn't the icon mapping configurable? +**A:** For performance reasons, icon mapping is hardcoded. If this looks like a problem, please come and chat with us on miaou. -**Q:** Why isn't the icon mapping configurable? -**A:** For performance reasons, icon mapping is hardcoded. If this looks like a problem, please come and chat with us. +**Q:** How do I remap in nerdfont? +**A:** If you want to map or remap icons, please go to <a href="https://www.nerdfonts.com/cheat-sheet" target="_blank">nerdfont-cheat-sheet</a> and search for an icon you would like to set in its place. +In order to correctly fix the icon mapping you need a FILE_EXTENSION and a NERDFONT_ICON_CODE. For this example we are remapping the json file extension. -**Q:** Why does broot show a generic icon for this very common file type? +The first thing you need to do is find the "json" icon you want to map to in the cheatsheet and copy its iconCode ("the code inside the red box in the screenshot below"). +Once done, find the corresponding file mapping in resources/icons/nerdfont by searching for your filetype in icon_name_to_icon_code_point_map: +In this case its this line: +``` +( "file_type_json", 0xe60b ), +``` +As you can see: the icon is mapped by "0x" followed by your iconCode. After changing this you should be able to recompile broot and see your new icon. If this is a new file mapping or a missing icon. Please consider contributing! -**A:** The icon mappings aren't complete. You can help out very easily without any coding knowledge. Go to the github [repository](https://github.com/Canop/broot/tree/main/resources/icons). Enter the directory corresponding to your theme. Inside `data`, edit `extension_to_icon_name_map.rs` and add a line corresponding to your extension. The first field would be the extensions you would like, and the second field should be referred from `icon_name_to_icon_code_point_map.rs`. Submit a PR. +![nerdfont cheatsheet iconCode](img/20240225-nerdfont-cheatsheet.png) -**Q:** Can I set up a totally different set of icons or mappings ? -**A:** Broot can be configured for a different mapping or a different font, but this needs some coding and a new compilation. -To get started, have a look at look at the `resources/icons` directory and, if necessary, come and chat on miaou. |