nu-ansi-term icon indicating copy to clipboard operation
nu-ansi-term copied to clipboard

feat: allow construct Style constantly

Open tisonkun opened this issue 1 year ago • 2 comments

tisonkun avatar Aug 05 '24 01:08 tisonkun

For what purpose? We recently closed these similar PRs. https://github.com/nushell/nu-ansi-term/pull/60 https://github.com/nushell/nu-ansi-term/pull/61

fdncred avatar Aug 05 '24 11:08 fdncred

My highlighter has a const color and I'd configure the color as a const.

Of course it's possible to initialize once at runtime and reuse the field, but I saw other existing const fns like:

  • pub const fn reset_before_style(&self) -> Style
  • pub const fn bold(&self) -> Style
  • pub const fn dimmed(&self) -> Style
  • pub const fn italic(&self) -> Style
  • pub const fn underline(&self) -> Style
  • pub const fn blink(&self) -> Style
  • pub const fn reverse(&self) -> Style
  • pub const fn hidden(&self) -> Style
  • pub const fn strikethrough(&self) -> Style
  • pub const fn fg(&self, foreground: Color) -> Style
  • pub const fn on(&self, background: Color) -> Style

So why not for new as it's in the same situation.

tisonkun avatar Aug 05 '24 12:08 tisonkun