(banner m)Returns a multi-line Figlet (ascii art) string with the provided :text
option.
Intended to render a "single line" banner.
Can be optionally colorized with the :gradient option, using a small set of
pre-defined gradients:
(banner {:text "Hello" :gradient-colors [:green :blue]})
Valid :gradient-color values:
[:green :blue],
[:red :magenta],
[:yellow :purple],
[:orange :purple],
[:cool :warm]
Valid :gradient-direction values:
:to-top,
:to-bottom,
:to-right,
:to-left
Can be colorized solid with bling.core/bling:
(bling [:red (banner {:text "Hello"})])
| Key | Pred | Description |
|---|---|---|
:font | map? | Must be one of the fonts that ships with Bling: bling.fonts.ansi-shadow/ansi-shadow, bling.fonts.big-money.big-money/big-money , bling.fonts.big/big, bling.fonts.miniwi/miniwi, bling.fonts.drippy/drippy, or bling.fonts.isometric-1/isometric-1. Defaults to bling.fonts.ansi-shadow/ansi-shadow. |
:text | string? | The text to set in the banner. |
:font-weight | keyword? | If set to :bold, each subchar in figlet characters will be bolded. Only applies when a gradient is set. |
:gradient-colors | vector? | Expects a vector of 2 keywords. Only the following color pairs are valid: [:green :blue], [:red :magenta], [:yellow :purple], [:orange :purple], [:cool :warm]. Only applies to terminal emulator printing |
:gradient-direction | keyword? | Expects a keyword. Must be one of: :to-top, :to-bottom, :to-right, and :to-left. Only applies to terminal emulator printing |
:gradient-shift | int? | If gradient is [:warm :cool] pair, this will shift the hue. 0-5. Defaults to 0. |
:contrast | keyword? | If gradient is set, this will force an overall lighter or darker tone. Defaults to :medium. If the user has a BLING_MOOD env var set, it will default to :high in order to optimize contrast for the users terminal theme (light or dark) |
:margin-top | int? | Amount of margin (in newlines) at top, outside banner. <br>Defaults to 1. Only applies to terminal emulator printing. |
:margin-bottom | int? | Amount of margin (in newlines) at bottom, outside banner. <br>Defaults to 0. Only applies to terminal emulator printing. |
:margin-left | int? | Amount of margin (in blank character spaces) at left, outside banner. <br>Defaults to 0. Only applies to terminal emulator printing. |
:margin-right | int? | Amount of margin (in blank character spaces) at right, outside banner. <br>Defaults to 0. Only applies to terminal emulator printing. |
Returns a multi-line Figlet (ascii art) string with the provided `:text`
option.
Intended to render a "single line" banner.
Can be optionally colorized with the `:gradient` option, using a small set of
pre-defined gradients:
```(banner {:text "Hello" :gradient-colors [:green :blue]})```
Valid `:gradient-color` values:
`[:green :blue]`,
`[:red :magenta]`,
`[:yellow :purple]`,
`[:orange :purple]`,
`[:cool :warm]`
Valid `:gradient-direction` values:
`:to-top`,
`:to-bottom`,
`:to-right`,
`:to-left`
Can be colorized solid with `bling.core/bling`:
```(bling [:red (banner {:text "Hello"})])```
| Key | Pred | Description |
| :--------------- | -----------| ------------- |
| `:font` | `map?` | Must be one of the fonts that ships with Bling: `bling.fonts.ansi-shadow/ansi-shadow`, `bling.fonts.big-money.big-money/big-money` , `bling.fonts.big/big`, `bling.fonts.miniwi/miniwi`, `bling.fonts.drippy/drippy,` or `bling.fonts.isometric-1/isometric-1`. Defaults to `bling.fonts.ansi-shadow/ansi-shadow`. |
| `:text` | `string?` | The text to set in the banner.
| `:font-weight` | `keyword?` | If set to `:bold`, each subchar in figlet characters will be bolded. Only applies when a gradient is set.
| `:gradient-colors` | `vector?` | Expects a vector of 2 keywords. Only the following color pairs are valid: `[:green :blue]`, `[:red :magenta]`, `[:yellow :purple]`, `[:orange :purple]`, `[:cool :warm]`. Only applies to terminal emulator printing|
| `:gradient-direction` | `keyword?` | Expects a keyword. Must be one of: `:to-top`, `:to-bottom`, `:to-right`, and `:to-left`. Only applies to terminal emulator printing|
| `:gradient-shift` | `int?` | If gradient is `[:warm :cool]` pair, this will shift the hue. `0-5`. Defaults to `0`.|
| `:contrast` | `keyword?` | If gradient is set, this will force an overall lighter or darker tone. Defaults to `:medium`. If the user has a `BLING_MOOD` env var set, it will default to `:high` in order to optimize contrast for the users terminal theme (light or dark) |
| `:margin-top` | `int?` | Amount of margin (in newlines) at top, outside banner. <br>Defaults to `1`. Only applies to terminal emulator printing. |
| `:margin-bottom` | `int?` | Amount of margin (in newlines) at bottom, outside banner. <br>Defaults to `0`. Only applies to terminal emulator printing. |
| `:margin-left` | `int?` | Amount of margin (in blank character spaces) at left, outside banner. <br>Defaults to `0`. Only applies to terminal emulator printing. |
| `:margin-right` | `int?` | Amount of margin (in blank character spaces) at right, outside banner. <br>Defaults to `0`. Only applies to terminal emulator printing. |(banner* {:keys [text letter-spacing font-weight gradient-direction
gradient-colors gradient-shift contrast :dev/print-font!
display-missing-chars?]
:as opts
:or {display-missing-chars? true
letter-spacing 0
gradient-colors nil
gradient-shift 0
gradient-direction :to-bottom
font-weight :normal}
user-font :font})(gradient-map gradient-colors direction gradient-shift contrast)Expects a string as first argument representing a linear-gradient in standard css syntax: "to bottom, yellow, purple"
Expects a map (banner opts) as second argument, from which a value for the :contrast option may be provided.
If the user has BLING_MOOD env var set, the darker or lighter variant of the base color will be used, depending on the value of BLING_MOOD, which corresponds to the background terminal. The purpose is to lower or heighten the contrast.
Returns a map: {:gradient-range '(40 41 42 43 44 45) ;; <- range of sgr codes :gradient-orientation :vertical :vertical-gradient? true :horizontal-gradient? false }
Expects a string as first argument representing a linear-gradient in standard
css syntax:
"to bottom, yellow, purple"
Expects a map (banner opts) as second argument, from which a value for the
:contrast option may be provided.
If the user has BLING_MOOD env var set, the darker or lighter variant of the
base color will be used, depending on the value of BLING_MOOD, which
corresponds to the background terminal. The purpose is to lower or heighten
the contrast.
Returns a map:
{:gradient-range '(40 41 42 43 44 45) ;; <- range of sgr codes
:gradient-orientation :vertical
:vertical-gradient? true
:horizontal-gradient? false
}(invalid-gradient-opt-warning! {:keys [gradient gradient-pairs-map
show-examples?]})(resolve-base-gradient-color-for-theme contrast color-str)cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |