(!?sgr s)Temporarily silences debugging of sgr code printing. Returns the value.
Temporarily silences debugging of sgr code printing. Returns the value.
(?sgr s)For debugging of ANSI SGR tagged output.
Prints the value with escaped ANSI SGR codes so you can read them in terminal emulators (otherwise text would just get colored). Preserves coloring.
Returns the value.
For debugging of ANSI SGR tagged output. Prints the value with escaped ANSI SGR codes so you can read them in terminal emulators (otherwise text would just get colored). Preserves coloring. Returns the value.
(bling & coll)Giving any number of strings or hiccup-like vectors, returns a string tagged with ANSI SGR codes to style the text as desired.
Giving any number of strings or hiccup-like vectors, returns a string tagged with ANSI SGR codes to style the text as desired.
(callout x & args)Prints a message to the console with a block-based coloring motif. Returns nil.
If the :data? option is set to true, it does not print anything, and
returns a data representation of the formatting and styling.
Callout prints a colored bounding border in the inline start position.
The color of the border is determined by the value of the :type option, or
the :colorway option. The characteristics of this border are controlled by
the :theme option.
For callouts of the type :error, :warning, or :info, a label is
printed in the block start postion. If a :type option is set, the label
string will default to an uppercased version of that string, e.g.
{:type :INFO} => "INFO". If a :label option is supplied, that value is
used instead. When you want to omit label for callouts of the type :error,
:warning, or :info, you must explicitly set the :label option to an empty
string.
The amount of vertical padding (in number of lines) within the bounds of the
message body can be controlled the padding-top and padding-bottom options.
The amount of space (in number of lines) above and below the message block
can be controlled the margin-top and margin-bottom options.
If two arguments are provided, the first should be a map of valid options.
Example call with all of the options
(callout {:type :error ; :warning, :info
;; :colorway :purple ; <- any bling palette color, overrides :type
;; :label "My label" ; overrides label assigned by :type
:side-label "My side label" ; must have a :label if you want a :side-label
:theme :sideline ; :sideline :sandwich :gutter
:label-theme :simple ; :simple :marquee
;; :padding-block 0
;; :padding-top 0
;; :padding-bottom 0
;; :padding-inline 2
;; :padding-left 2
;; :padding-right 0
;; :margin-top 1
;; :margin-botom 0
;; :margin-left 0
;; :data? true ; <- just returns string, no printing
:border-shape :sharp ; :round
:border-style :solid ; :double
:border-weight :normal ; :bold
:width 40
:min-width 40
;; --- The options below exclusive to :theme of :boxed ---
;; :border-char "*"
;; :vertical-border-char "**"
;; :max-width 100
;; :padding-block 1
;; :padding-inline 2
}
(bling [:bold (str "Line 1" "\n" "Line 2")])```
All the options:
* **`:colorway`**
- `#{"neutral" "magenta" "warning" "positive" :neutral "info" :green :positive "negative" :negative "error" "subtle" :warning "green" :info :error :magenta :subtle}`
- Optional.
- The color of the border, or gutter, depending on the value of `:theme`.
* **`:theme`**
- `#{"boxed" "sideline" :boxed :sideline "gutter" :sandwich "simple" :gutter}`
- Optional.
- Defaults to `:sideline`.
- Name of callout layout template.
* **`:label`**
- `any?`
- Optional.
- Labels the callout.
In the case of a callout `:type` of `:warning`, `:error`, or `:info`,
the value of the label will default to `WARNING`, `ERROR`, or `INFO`, respectively.
* **`:side-label`**
- `any?`
- Optional.
- Side label to the the callout label. In the case of a callout
`:type` of `:warning`, `:error`, or `:info`, the value of the label
will default to `WARNING`, `ERROR`, or `INFO`, respectively.
* **`:label-theme`**
- `#{:simple "marquee" :marquee "simple"}`
- Optional.
- Defaults to `:simple`.
- Name of label flavor.
* **`:padding-block`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at top and bottom, inside callout.
* **`:padding-top`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at top, inside callout.
* **`:padding-bottom`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at bottom, inside callout.
* **`:padding-inline`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of padding (in blank character spaces) at left and right, inside callout.
* **`:padding-left`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of padding (in blank character spaces) at left, inside callout.
* **`:margin-top`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of margin (in newlines) at top, outside callout.
Only applies to terminal emulator printing.
* **`:margin-bottom`**
- `int?`
- Optional.
- Defaults to `0`.
- Amount of margin (in newlines) at bottom, outside callout.
Only applies to terminal emulator printing.
* **`:margin-left`**
- `int?`
- Optional.
- Defaults to `0`.
- Amount of margin (in blank character spaces) at left, outside callout.
* **`:data?`**
- `boolean?`
- Optional.
- Returns a data representation of result instead of printing it.
* **`:header-padding-left`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of left margin (in character spaces) for the label, in the callout header
* **`:header-gap`**
- `int?`
- Optional.
- Defaults to `5`.
- The gap (in character spaces) the label and the optional side lable, in the callout header.
* **`:border-style`**
- `#{:double :solid "solid" "double"}`
- Optional.
- Defaults to `:solid`.
- The style of box-drawing character used.
* **`:border-weight`**
- `#{:bold "normal" :normal "bold"}`
- Optional.
- Defaults to `:normal`.
- The weight of box-drawing character used. Applies only to `:border-style` of `:solid`
* **`:border-shape`**
- `#{"sharp" :round :sharp "round"}`
- Optional.
- Defaults to `:sharp`.
- The corner shape of the borders, either sharp or round. Only applies when `:border-style` is
`:solid` AND `:border-weight` is `:normal`
* **`:border-notches?`**
- `boolean?`
- Optional.
- Defaults to `:false`.
- Only applies to `:sandwich` callout theme. Will use top-left-corner
and bottom-right-corner box-drawing chars for first character of header and footer borders.
* **`:border-weight`**
- `#{:bold "normal" :normal "bold"}`
- Optional.
- Defaults to `:normal`.
- The style of box-drawing character used.
* **`:width`**
- `pos-int?`
- Optional.
- Width of the box in number of chars, aka columns in
terminal. If not set, will be the width of the terminal.
If terminal width cannot be detected, will fallback to 80.
* **`:min-width`**
- `pos-int?`
- Optional.
- Min width of box in number of chars, aka columns in
terminal. Overridden by the `:width` value, if set.
* **`:border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing
* **`:vertical-border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing character,
for the vertical borders.
* **`:horizontal-border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing character,
for the horizontal borders.
* **`:box-drawing-style`**
- `#{:bold :thin-round :double "thin" :thin "thin-round" "double" "bold"}`
- Optional.
- The style of box-drawing character used.
* **`:max-width`**
- `pos-int?`
- Optional.
- Max width of box in number of chars, aka columns in
terminal. Overridden by the `:width` value, if set.
Prints a message to the console with a block-based coloring motif.
Returns nil.
If the `:data?` option is set to `true`, it does not print anything, and
returns a data representation of the formatting and styling.
Callout prints a colored bounding border in the inline start position.
The color of the border is determined by the value of the `:type` option, or
the `:colorway` option. The characteristics of this border are controlled by
the `:theme` option.
For callouts of the type `:error`, `:warning`, or `:info`, a label is
printed in the block start postion. If a :type option is set, the label
string will default to an uppercased version of that string, e.g.
{:type :INFO} => "INFO". If a `:label` option is supplied, that value is
used instead. When you want to omit label for callouts of the type `:error`,
`:warning`, or `:info`, you must explicitly set the :label option to an empty
string.
The amount of vertical padding (in number of lines) within the bounds of the
message body can be controlled the `padding-top` and `padding-bottom` options.
The amount of space (in number of lines) above and below the message block
can be controlled the `margin-top` and `margin-bottom` options.
If two arguments are provided, the first should be a map of valid options.
Example call with all of the options
```clojure
(callout {:type :error ; :warning, :info
;; :colorway :purple ; <- any bling palette color, overrides :type
;; :label "My label" ; overrides label assigned by :type
:side-label "My side label" ; must have a :label if you want a :side-label
:theme :sideline ; :sideline :sandwich :gutter
:label-theme :simple ; :simple :marquee
;; :padding-block 0
;; :padding-top 0
;; :padding-bottom 0
;; :padding-inline 2
;; :padding-left 2
;; :padding-right 0
;; :margin-top 1
;; :margin-botom 0
;; :margin-left 0
;; :data? true ; <- just returns string, no printing
:border-shape :sharp ; :round
:border-style :solid ; :double
:border-weight :normal ; :bold
:width 40
:min-width 40
;; --- The options below exclusive to :theme of :boxed ---
;; :border-char "*"
;; :vertical-border-char "**"
;; :max-width 100
;; :padding-block 1
;; :padding-inline 2
}
(bling [:bold (str "Line 1" "\n" "Line 2")])```
All the options:
* **`:colorway`**
- `#{"neutral" "magenta" "warning" "positive" :neutral "info" :green :positive "negative" :negative "error" "subtle" :warning "green" :info :error :magenta :subtle}`
- Optional.
- The color of the border, or gutter, depending on the value of `:theme`.
* **`:theme`**
- `#{"boxed" "sideline" :boxed :sideline "gutter" :sandwich "simple" :gutter}`
- Optional.
- Defaults to `:sideline`.
- Name of callout layout template.
* **`:label`**
- `any?`
- Optional.
- Labels the callout.
In the case of a callout `:type` of `:warning`, `:error`, or `:info`,
the value of the label will default to `WARNING`, `ERROR`, or `INFO`, respectively.
* **`:side-label`**
- `any?`
- Optional.
- Side label to the the callout label. In the case of a callout
`:type` of `:warning`, `:error`, or `:info`, the value of the label
will default to `WARNING`, `ERROR`, or `INFO`, respectively.
* **`:label-theme`**
- `#{:simple "marquee" :marquee "simple"}`
- Optional.
- Defaults to `:simple`.
- Name of label flavor.
* **`:padding-block`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at top and bottom, inside callout.
* **`:padding-top`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at top, inside callout.
* **`:padding-bottom`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of padding (in newlines) at bottom, inside callout.
* **`:padding-inline`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of padding (in blank character spaces) at left and right, inside callout.
* **`:padding-left`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of padding (in blank character spaces) at left, inside callout.
* **`:margin-top`**
- `int?`
- Optional.
- Defaults to `1`.
- Amount of margin (in newlines) at top, outside callout.
Only applies to terminal emulator printing.
* **`:margin-bottom`**
- `int?`
- Optional.
- Defaults to `0`.
- Amount of margin (in newlines) at bottom, outside callout.
Only applies to terminal emulator printing.
* **`:margin-left`**
- `int?`
- Optional.
- Defaults to `0`.
- Amount of margin (in blank character spaces) at left, outside callout.
* **`:data?`**
- `boolean?`
- Optional.
- Returns a data representation of result instead of printing it.
* **`:header-padding-left`**
- `int?`
- Optional.
- Defaults to `2`.
- Amount of left margin (in character spaces) for the label, in the callout header
* **`:header-gap`**
- `int?`
- Optional.
- Defaults to `5`.
- The gap (in character spaces) the label and the optional side lable, in the callout header.
* **`:border-style`**
- `#{:double :solid "solid" "double"}`
- Optional.
- Defaults to `:solid`.
- The style of box-drawing character used.
* **`:border-weight`**
- `#{:bold "normal" :normal "bold"}`
- Optional.
- Defaults to `:normal`.
- The weight of box-drawing character used. Applies only to `:border-style` of `:solid`
* **`:border-shape`**
- `#{"sharp" :round :sharp "round"}`
- Optional.
- Defaults to `:sharp`.
- The corner shape of the borders, either sharp or round. Only applies when `:border-style` is
`:solid` AND `:border-weight` is `:normal`
* **`:border-notches?`**
- `boolean?`
- Optional.
- Defaults to `:false`.
- Only applies to `:sandwich` callout theme. Will use top-left-corner
and bottom-right-corner box-drawing chars for first character of header and footer borders.
* **`:border-weight`**
- `#{:bold "normal" :normal "bold"}`
- Optional.
- Defaults to `:normal`.
- The style of box-drawing character used.
* **`:width`**
- `pos-int?`
- Optional.
- Width of the box in number of chars, aka columns in
terminal. If not set, will be the width of the terminal.
If terminal width cannot be detected, will fallback to 80.
* **`:min-width`**
- `pos-int?`
- Optional.
- Min width of box in number of chars, aka columns in
terminal. Overridden by the `:width` value, if set.
* **`:border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing
* **`:vertical-border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing character,
for the vertical borders.
* **`:horizontal-border-char`**
- `string?`
- Optional.
- A char that will override the default box-drawing character,
for the horizontal borders.
* **`:box-drawing-style`**
- `#{:bold :thin-round :double "thin" :thin "thin-round" "double" "bold"}`
- Optional.
- The style of box-drawing character used.
* **`:max-width`**
- `pos-int?`
- Optional.
- Max width of box in number of chars, aka columns in
terminal. Overridden by the `:width` value, if set.(file-info-str {:keys [:file :line :column :line-style :column-style :file-style
:style]
:or {style {}}})(highlighted-location s)(highlighted-location s target-highlight-style)(point-of-interest {:keys [form line column header-file-info-style
header-file-name-style header-line-number-style
header-column-number-style margin-block margin-top
margin-bottom gutter-line-number-style]
:as opts})(print-bling & args)In JVM Clojure, cljs(Node), and bb, print-bling is sugar for:
(println (bling [:bold.blue "my blue text"]))
In cljs (browser dev consoles), print-bling is sugar for the the following:
(print-to-browser-dev-console (bling [:bold.blue "my blue text"]))
Example: `(print-bling [:bold.blue "my blue text"])
In JVM Clojure, cljs(Node), and bb, `print-bling` is sugar for: (println (bling [:bold.blue "my blue text"])) In cljs (browser dev consoles), `print-bling` is sugar for the the following: `(print-to-browser-dev-console (bling [:bold.blue "my blue text"]))` Example: `(print-bling [:bold.blue "my blue text"])
(with-ascii-underline s
{:keys [line-index underline-char text-decoration-style
text-decoration-color text-decoration-weight]
:or {text-decoration-style :wavy
line-index :bling.core/unsupplied}
:as opts})If supplied value for :form is a multi-line string, and supplied
value for :line-index is an integer less than the number of lines
present, inserts an ascii underline below the specified row.
If supplied value for `:form` is a multi-line string, and supplied value for `:line-index` is an integer less than the number of lines present, inserts an ascii underline below the specified row.
(with-floating-label s {:keys [line-index label-text label-style label-offset]})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 |