Home

Awesome

Showybox (v2.0.3)

Showybox is a Typst package for creating colorful and customizable boxes.

Please note that this repository contains the latest (development) version of this package and may not yet be published at Typst's official package repository. If you want to use this package, see https://github.com/typst/packages/tree/main/packages/preview for the latest stable version

Usage

To use this library through the Typst package manager (for Typst 0.6.0 or greater), write #import "@preview/showybox:2.0.2": showybox at the beginning of your Typst file.

Once imported, you can create an empty showybox by using the function showybox() and giving a default body content inside the parenthesis or outside them using squared brackets [].

By default a showybox with these properties will be created:

#import "@preview/showybox:2.0.2": showybox

#showybox(
  [Hello world!]
)
<h3 align="center"> <img alt="Hello world! example" src="assets/hello-world.png" style="max-width: 95%; background-color: #FFFFFF; padding: 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Looks quite simple, but the "magic" starts when adding a title, color and shadows. The following code creates two "unique" boxes with defined colors and custom borders:

// First showybox
#showybox(
  frame: (
    border-color: red.darken(50%),
    title-color: red.lighten(60%),
    body-color: red.lighten(80%)
  ),
  title-style: (
    color: black,
    weight: "regular",
    align: center
  ),
  shadow: (
    offset: 3pt,
  ),
  title: "Red-ish showybox with separated sections!",
  lorem(20),
  lorem(12)
)

// Second showybox
#showybox(
  frame: (
    dash: "dashed",
    border-color: red.darken(40%)
  ),
  body-style: (
    align: center
  ),
  sep: (
    dash: "dashed"
  ),
  shadow: (
	  offset: (x: 2pt, y: 3pt),
    color: yellow.lighten(70%)
  ),
  [This is an important message!],
  [Be careful outside. There are dangerous bananas!]
)
<h3 align="center"> <img alt="Further examples" src="assets/two-easy-examples.png" style="max-width: 95%; background-color: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Reference

The showybox() function can receive the following parameters:

Frame properties

Title styles

Boxed styles

Body styles

Footer styles

Separator properties

Shadow properties

Gallery

Colors for title, body and footer example (Stokes' theorem)

<h3 align="center"> <img alt="Encapsulation" src="assets/stokes-example.png" style="max-width: 95%; background-color: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Boxed-title example (Clairaut's theorem)

<h3 align="center"> <img alt="Encapsulation" src="assets/clairaut-example.png" style="max-width: 95%; background-color: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Encapsulation example

<h3 align="center"> <img alt="Encapsulation" src="assets/encapsulation-example.png" style="max-width: 95%; background-color: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Breakable showybox example (Newton's second law)

<h3 align="center"> <img alt="Enabling breakable" src="assets/newton-example.png" style="max-width: 95%; padding: 10px 10px; background-color: #FFFFFF; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Custom radius and title's separator thickness example (Carnot's cycle efficency)

<h3 align="center"> <img alt="Custom radius" src="assets/carnot-example.png" style="max-width: 95%; background: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Custom border dash and inset example (Gauss's law)

<h3 align="center"> <img alt="Custom radius" src="assets/gauss-example.png" style="max-width: 95%; background: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Custom footer's separator thickness example (Divergence's theorem)

<h3 align="center"> <img alt="Custom radius" src="assets/divergence-example.png" style="max-width: 95%; background: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Colorful shadow example (Coulomb's law)

<h3 align="center"> <img alt="Custom radius" src="assets/coulomb-example.png" style="max-width: 95%; background: #FFFFFF; padding: 10px 10px; box-shadow: 1pt 1pt 10pt 0pt #AAAAAA; border-radius: 4pt"> </h3>

Changelog

Version 2.0.3

Version 2.0.2

Version 2.0.1

Version 2.0.0

Special thanks to Andrew Voynov (https://github.com/Andrew15-5) for the feedback while creating the new behaviours for boxed-titles

Version 1.1.0

Version 1.0.0

Changes below were performed by Jonas Neugebauer (https://github.com/jneug)

Version 0.2.1

All changes listed here were performed by Jonas Neugebauer (https://github.com/jneug)

Version 0.2.0

Version 0.1.1

Version 0.1.0