Commit Graph

3 Commits

Author SHA1 Message Date
NotTheDr01ds
9a12d8df39
Additional Theme Features (#925)
Changes to `make.nu`:

* Adds in missing shapes and types noted further down in this PR by
@fdncred
* Adds colors for types - Mostly matching the corresponding shape, but
with any attribute (e.g., bold) removed
* Changed `int` and `float` values to be distinct. In most themes, the
colors should be complementary.
* Changes `bool: false` and `hints` colors - They were hardcoded to
`dark_grey` and wouldn't show up on some themes. Now uses a theme color
that should correspond to a theme-appropriate grey in most cases.
* Alphabetizes shapes and types so that Previews are also sorted
properly
* Eliminated spurious newline when sourcing theme (from printing OSC
codes for terminal colors)
* Renamed `3024` theme to `3024r` since module names can't be an `int`

Changes to `theme preview small`:

* Remove extra vertical spacing that was caused by different-sized row
column content
* Logically group elements - Types, Conditionally computed (closures)
types, Shapes, and other Structure (e.g., header, row_index, foreground,
etc.)
* Displays foreground/background on one line for clarity

Result is a much more compact, but also more readable, table.

Comparison:

<details><summary>Before</summary>
<p>
<img
src="https://github.com/user-attachments/assets/2673855d-d20d-4e14-8029-255138f2ecc9"
/>
</p>
</details> 

<details><summary>After</summary>
<p>
<img
src="https://github.com/user-attachments/assets/c8824b7a-440d-4567-bd69-b2e1df358340"
/>
</p>
</details> 

* Also refactored a lot of the code to be more maintainable - Moves the
rendering off to separate functions.

Changes to `preview_generate_screenshots.nu`:

* Accepts the method for generating screenshots as an argument
* Additional generation method using asciinema, agg (asciinema to
animated gif), and ffmpeg (to convert the animated gif to a single-image
PNG)

Additional Notes:

- Some Lemnos themes use color values that are the same (or nearly the
same) as the background in places. These are "broken" themes and always
have been as some elements will simply not be visible.

- There's a longstanding (I believe) bug that special-cased `record` for
the *key* rather than the *value*. I've fixed it so that the *key* is
now handled properly (same as other types), but I haven't implemented
any changes for color values that use a record (e.g., `{ fg: "#80a1a1",
attr: "b" }`) as this would make the table less compact. I'll look at
doing this for the longer form `preview theme` later.

- Closures other than for `string`, `bool`, `date`, and `filesize` are
currently only displayed as a summary. There aren't any themes currently
that this impacts, but if you create one manually, the display results
were pretty bad. This is primarily due to bad indentation from
`config.nu` (and/or defaults). A proper `nu-indent` would help fix this,
or maybe we could just remove all whitespace and display any closure as
a one-liner.

I probably won't regenerate screenshots until we figure out what to do
about the "monotone" type colors.
2024-07-29 17:08:13 -05:00
NotTheDr01ds
995c1ea21c
Update theme preview scripts and screenshots (#909)
Lots of changes - Pretty every change needed to be made before updating
the preview screenshots, so they all end up in the same PR here:

* `preview-generate-screenshots.nu` now generates the previews and
screenshots all in one pass rather than requiring a separate file.

* Adds a new method for generating screenshots using PowerShell with no
third-party application required. Created new function for choosing the
method that is used to generate screenshots.

* Fixes background color on `nushell-dark` and `nushell-light` themes.

* Fixes bug where `cursor` setting (and perhaps one other) was getting
dropped from the preview table (`math ceil` was needed rather than `math
floor`)

* Fixes `cellpath` setting - Was changed to `cell-path` a while back but
never updated in the themes. All themes and their previews were
regenerated. Custom themes were manually adjusted.

* **Important:** I did not update `make.nu` to fix this (yet) since
@amtoine has a open PR against it that has not been merged yet. Easier
to either put that change in that PR or do it after that one has been
merged.

* Adds `mod.nu` in the root of the `themes` module. Moves some of the
previous script commands such as `preview_terminal`,
`preview_theme_small`, etc. over to the module. Makes for cleaner usage.

* Note: The completion functions in the scripts have been broken for
several months. I did not fix this at this point.

* `preview_theme_small` (and others) renamed to use spaces in command
name, so it is now `preview theme small`.

* Fixes bug of my own making that prevented several custom themes from
working.

* Refactors the "list to columns" code to use `group` (will need to be
updated to `chunks` in 0.96)
* Suppresses the indices column in the preview table
* Removes the column headers entirely since they don't serve any purpose
in this type of "columnar table"
2024-07-22 14:21:28 -05:00
Darren Schroeder
716129378a
create readme.md with theme previews (#519)
* create readme.md with theme previews

* fix bug, tweak themes

* update themes

* re-add readme.md
2023-06-12 11:57:22 -05:00