add 6 more table themes (#10279)

# Description

After looking at a users terminal that didn't support UTF-8, I wanted to
add some themes that may help them. Here's what they look like.

## psql

![image](https://github.com/nushell/nushell/assets/343840/67ac003a-72f1-4e2b-8bb0-244b70385d59)

## markdown

![image](https://github.com/nushell/nushell/assets/343840/a8f4a439-013b-48ee-b9e0-284ec47d1eef)

## dots
please excuse the different theme

![image](https://github.com/nushell/nushell/assets/343840/fb931650-cc64-4f0a-bf3d-ec736e0374ad)

## restructured

![image](https://github.com/nushell/nushell/assets/343840/80595a8e-f2b3-49dc-ad02-81e94bde5253)

## ascii_rounded

![image](https://github.com/nushell/nushell/assets/343840/42f0b8b2-1fd2-4ae5-b28c-477e83ded354)

## basic_compact

![image](https://github.com/nushell/nushell/assets/343840/5888b6b2-b9b8-48bc-963e-5a76ef246adc)


# User-Facing Changes
<!-- List of all changes that impact the user experience here. This
helps us keep track of breaking changes. -->

# Tests + Formatting
<!--
Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

- `cargo fmt --all -- --check` to check standard code formatting (`cargo
fmt --all` applies these changes)
- `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to
check that you're using the standard code style
- `cargo test --workspace` to check that all tests pass (on Windows make
sure to [enable developer
mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging))
- `cargo run -- -c "use std testing; testing run-tests --path
crates/nu-std"` to run the tests for the standard library

> **Note**
> from `nushell` you can also use the `toolkit` as follows
> ```bash
> use toolkit.nu # or use an `env_change` hook to activate it
automatically
> toolkit check pr
> ```
-->

# After Submitting
<!-- If your PR had any user-facing changes, update [the
documentation](https://github.com/nushell/nushell.github.io) after the
PR is merged, if necessary. This will help us keep the docs up to date.
-->
This commit is contained in:
Darren Schroeder 2023-09-08 16:34:36 -05:00 committed by GitHub
parent fed4233db4
commit 2ffff959fc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 0 deletions

View file

@ -330,6 +330,12 @@ fn supported_table_modes() -> Vec<Value> {
Value::test_string("rounded"),
Value::test_string("thin"),
Value::test_string("with_love"),
Value::test_string("psql"),
Value::test_string("markdown"),
Value::test_string("dots"),
Value::test_string("restructured"),
Value::test_string("ascii_rounded"),
Value::test_string("basic_compact"),
]
}

View file

@ -157,6 +157,12 @@ pub fn load_theme_from_config(config: &Config) -> TableTheme {
"reinforced" => TableTheme::reinforced(),
"heavy" => TableTheme::heavy(),
"none" => TableTheme::none(),
"psql" => TableTheme::psql(),
"markdown" => TableTheme::markdown(),
"dots" => TableTheme::dots(),
"restructured" => TableTheme::resturctured(),
"ascii_rounded" => TableTheme::ascii_rounded(),
"basic_compact" => TableTheme::basic_compact(),
_ => TableTheme::rounded(),
}
}

View file

@ -38,6 +38,56 @@ impl TableTheme {
}
}
pub fn psql() -> TableTheme {
Self {
theme: Style::psql().into(),
full_theme: Style::psql().into(),
has_inner: true,
}
}
pub fn markdown() -> TableTheme {
Self {
theme: Style::markdown().into(),
full_theme: Style::markdown().into(),
has_inner: true,
}
}
pub fn dots() -> TableTheme {
let theme = Style::dots().remove_horizontal().into();
Self {
theme,
full_theme: Style::dots().into(),
has_inner: true,
}
}
pub fn resturctured() -> TableTheme {
Self {
theme: Style::re_structured_text().into(),
full_theme: Style::re_structured_text().into(),
has_inner: true,
}
}
pub fn ascii_rounded() -> TableTheme {
Self {
theme: Style::ascii_rounded().into(),
full_theme: Style::ascii_rounded().into(),
has_inner: true,
}
}
pub fn basic_compact() -> TableTheme {
let theme = Style::ascii().remove_horizontal().into();
Self {
theme,
full_theme: Style::ascii().into(),
has_inner: true,
}
}
pub fn compact() -> TableTheme {
let theme = Style::modern()
.remove_left()