Liking cljdoc? Tell your friends :D

charm.style.core

Main styling API.

Create styles as maps and apply them to text.

Example: (def my-style (style :fg (rgb 255 0 0) :bold true :padding [1 2])) (render my-style "Hello!") ; => styled text

Main styling API.

Create styles as maps and apply them to text.

Example:
  (def my-style (style :fg (rgb 255 0 0) :bold true :padding [1 2]))
  (render my-style "Hello!")  ; => styled text
raw docstring

ansiclj

source

ansi256clj

source

attributed-stringclj

(attributed-string style-map text)

Create a JLine AttributedString with the given style applied.

This avoids the ANSI parse/unparse cycle when building content that will be rendered directly via JLine's Display.

For single lines without layout (padding, border, margin): (attributed-string my-style "Hello!")

For multiple parts with different styles: (-> (AttributedStringBuilder.) (.styled (style->attributed-style style1) "part1") (.styled (style->attributed-style style2) "part2") (.toAttributedString))

Create a JLine AttributedString with the given style applied.

This avoids the ANSI parse/unparse cycle when building content
that will be rendered directly via JLine's Display.

For single lines without layout (padding, border, margin):
  (attributed-string my-style "Hello!")

For multiple parts with different styles:
  (-> (AttributedStringBuilder.)
      (.styled (style->attributed-style style1) "part1")
      (.styled (style->attributed-style style2) "part2")
      (.toAttributedString))
sourceraw docstring

blackclj

source

blueclj

source

cyanclj

source

double-borderclj

source

frame-sizeclj

(frame-size {:keys [padding margin border]})

Calculate the frame size (padding + border + margin) of a style. Returns [width height].

Calculate the frame size (padding + border + margin) of a style.
Returns [width height].
sourceraw docstring

greenclj

source

hexclj

source

hidden-borderclj

source

join-horizontalclj

source

join-verticalclj

source

magentaclj

source

normal-borderclj

source

redclj

source

renderclj

(render style & strings)

Render text with a style applied.

(render style "text") (render style "multiple" "strings")

Render text with a style applied.

(render style "text")
(render style "multiple" "strings")
sourceraw docstring

rgbclj

source

rounded-borderclj

source

styleclj

(style & {:as opts})

Create a style map.

Options: ;; Colors :fg - Foreground color :bg - Background color

;; Text attributes :bold - Bold text :italic - Italic text :underline - Underline text :blink - Blinking text :faint - Faint/dim text :reverse - Reverse video

;; Dimensions :width - Fixed width (pads/truncates) :height - Fixed height

;; Alignment :align - Horizontal alignment (:left :center :right) :valign - Vertical alignment (:top :center :bottom)

;; Spacing :padding - Padding [top right bottom left] or single value :margin - Margin [top right bottom left] or single value

;; Border :border - Border style (from charm.style.border) :border-fg - Border foreground color :border-bg - Border background color

;; Rendering :inline - Remove newlines when true

Create a style map.

Options:
  ;; Colors
  :fg         - Foreground color
  :bg         - Background color

  ;; Text attributes
  :bold       - Bold text
  :italic     - Italic text
  :underline  - Underline text
  :blink      - Blinking text
  :faint      - Faint/dim text
  :reverse    - Reverse video

  ;; Dimensions
  :width      - Fixed width (pads/truncates)
  :height     - Fixed height

  ;; Alignment
  :align      - Horizontal alignment (:left :center :right)
  :valign     - Vertical alignment (:top :center :bottom)

  ;; Spacing
  :padding    - Padding [top right bottom left] or single value
  :margin     - Margin [top right bottom left] or single value

  ;; Border
  :border     - Border style (from charm.style.border)
  :border-fg  - Border foreground color
  :border-bg  - Border background color

  ;; Rendering
  :inline     - Remove newlines when true
sourceraw docstring

style->attributed-styleclj

(style->attributed-style {:keys [fg bg bold italic underline blink faint
                                 reverse]})

Convert style map to JLine AttributedStyle.

Useful for direct AttributedString construction: (AttributedString. text (style->attributed-style my-style))

Convert style map to JLine AttributedStyle.

Useful for direct AttributedString construction:
  (AttributedString. text (style->attributed-style my-style))
sourceraw docstring

styledclj

(styled text & style-opts)

Apply style directly to text. Shorthand for (render (style opts...) text).

(styled "hello" :fg (rgb 255 0 0) :bold true)

Apply style directly to text. Shorthand for (render (style opts...) text).

(styled "hello" :fg (rgb 255 0 0) :bold true)
sourceraw docstring

thick-borderclj

source

whiteclj

source

with-alignclj

(with-align s align)

Set horizontal alignment.

Set horizontal alignment.
sourceraw docstring

with-bgclj

(with-bg s color)

Set background color.

Set background color.
sourceraw docstring

with-boldclj

(with-bold s)

Set bold.

Set bold.
sourceraw docstring

with-borderclj

(with-border s border-style)

Set border style.

Set border style.
sourceraw docstring

with-fgclj

(with-fg s color)

Set foreground color.

Set foreground color.
sourceraw docstring

with-heightclj

(with-height s height)

Set fixed height.

Set fixed height.
sourceraw docstring

with-italicclj

(with-italic s)

Set italic.

Set italic.
sourceraw docstring

with-marginclj

(with-margin s margin)

Set margin. Accepts [t r b l] or single value.

Set margin. Accepts [t r b l] or single value.
sourceraw docstring

with-paddingclj

(with-padding s padding)

Set padding. Accepts [t r b l] or single value.

Set padding. Accepts [t r b l] or single value.
sourceraw docstring

with-underlineclj

(with-underline s)

Set underline.

Set underline.
sourceraw docstring

with-valignclj

(with-valign s valign)

Set vertical alignment.

Set vertical alignment.
sourceraw docstring

with-widthclj

(with-width s width)

Set fixed width.

Set fixed width.
sourceraw docstring

yellowclj

source

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