Liking cljdoc? Tell your friends :D
All platforms.

bling.banner


(banner m)

Returns a multi-line Figlet (ascii art) string with the provided :text option. Intended to render a "single line" banner, consisting of multiple lines of constituent characters.

Can be optionally colorized with the :gradient option, using a small set of pre-defined gradients:

(banner {:text "Hello", :gradient-colors [:green :blue]})

(banner {:text "Hello", :gradient-colors [:red :magenta]})

(banner {:text "Hello", :gradient-colors [:yellow :purple]})

(banner {:text "Hello", :gradient-colors [:orange :purple]})

(banner {:text "Hello", :gradient-colors [:cool :warm]})

Can be colorized solid with bling.core/bling

(bling [:red (banner {:text "Hello"})])

All the options:

  • :text

    • string?
    • Required.
    • The text to set in the banner.
  • :font-weight

    • #{:bold "bold"}
    • Optional.
    • If set to :bold, each subchar in figlet characters will be bolded. Only applies when a gradient is set.
  • :gradient-colors

    • #{[:yellow :purple] ["orange" "purple"] ["yellow" "purple"] ["red" "magenta"] [:red :magenta] ["green" "blue"] ["cool" "warm"] [:green :blue] [:cool :warm] [:orange :purple]}
    • Optional.
    • Sets the beginning and end colors of the gradient. Expects a vector of 2 keywords.
  • :gradient-direction

    • #{:to-right "to-left" :to-top "to-top" :to-left "to-bottom" "to-right" :to-bottom}
    • Optional.
    • Direction of the gradient.
  • :gradient-shift

    • [:int {:min 0, :max 5}]
    • Optional.
    • Defaults to 0.
    • If gradient is [:warm :cool] pair, this will shift the hue.
  • :contrast

    • keyword?
    • Optional.
    • Defaults to :medium.
    • If gradient is set, this will force an overall lighter or darker tone. 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?
    • Optional.
    • Defaults to 1.
    • Amount of margin (in newlines) at top, outside banner.
  • :margin-bottom

    • int?
    • Optional.
    • Defaults to 0.
    • Amount of margin (in newlines) at bottom, outside banner.
  • :margin-left

    • int?
    • Optional.
    • Defaults to 0.
    • Amount of margin (in blank character spaces) at left, outside banner.
  • :margin-right

    • int?
    • Optional.
    • Defaults to 0.
    • Amount of margin (in blank character spaces) at right, outside banner.

Returns a multi-line Figlet (ascii art) string with the provided
`:text` option. Intended to render a "single line" banner,
consisting of multiple lines of constituent characters.

Can be optionally colorized with the `:gradient` option,
using a small set of pre-defined gradients:
```clojure
(banner {:text "Hello", :gradient-colors [:green :blue]})

(banner {:text "Hello", :gradient-colors [:red :magenta]})

(banner {:text "Hello", :gradient-colors [:yellow :purple]})

(banner {:text "Hello", :gradient-colors [:orange :purple]})

(banner {:text "Hello", :gradient-colors [:cool :warm]})
```

Can be colorized solid with `bling.core/bling`
```clojure
(bling [:red (banner {:text "Hello"})])
```

All the options:

* **`:text`**
    - `string?`
    - Required.
    - The text to set in the banner.

* **`:font-weight`**
    - `#{:bold "bold"}`
    - Optional.
    - If set to `:bold`, each subchar in figlet characters
      will be bolded. Only applies when a gradient is set.

* **`:gradient-colors`**
    - `#{[:yellow :purple] ["orange" "purple"] ["yellow" "purple"] ["red" "magenta"] [:red :magenta] ["green" "blue"] ["cool" "warm"] [:green :blue] [:cool :warm] [:orange :purple]}`
    - Optional.
    - Sets the beginning and end colors of the gradient.
      Expects a vector of 2 keywords.

* **`:gradient-direction`**
    - `#{:to-right "to-left" :to-top "to-top" :to-left "to-bottom" "to-right" :to-bottom}`
    - Optional.
    - Direction of the gradient.

* **`:gradient-shift`**
    - `[:int {:min 0, :max 5}]`
    - Optional.
    - Defaults to `0`.
    - If gradient is `[:warm :cool]` pair, this will shift the hue.

* **`:contrast`**
    - `keyword?`
    - Optional.
    - Defaults to `:medium`.
    - If gradient is set, this will force an overall lighter or
      darker tone. 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?`
    - Optional.
    - Defaults to `1`.
    - Amount of margin (in newlines) at top, outside banner.

* **`:margin-bottom`**
    - `int?`
    - Optional.
    - Defaults to `0`.
    - Amount of margin (in newlines) at bottom, outside banner.

* **`:margin-left`**
    - `int?`
    - Optional.
    - Defaults to `0`.
    - Amount of margin (in blank character spaces) at left,
      outside banner.

* **`:margin-right`**
    - `int?`
    - Optional.
    - Defaults to `0`.
    - Amount of margin (in blank character spaces) at right,
      outside banner.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
Move to previous article
Move to next article
Ctrl+/Jump to the search field
× close