Socket
Socket
Sign inDemoInstall

@otovo/rainbow-tailwind

Package Overview
Dependencies
Maintainers
8
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@otovo/rainbow-tailwind

Otovo's design system implemented using Tailwind


Version published
Weekly downloads
155
increased by4.03%
Maintainers
8
Weekly downloads
 
Created
Source

🌈 rainbow-tailwind

Otovo's design system implemented using Tailwind

Getting started

  1. Setup Tailwind by following the instructions in the official Tailwind installation documentation.

  2. Install @otovo/rainbow-tailwind

yarn add @otovo/rainbow-tailwind
  1. Create the file tailwind.config.js at the root of your project. This is where we add the Rainbow overrides:
const plugin = require('tailwindcss/plugin');
const { theme, variants, plugins } = require('@otovo/rainbow-tailwind/dist');

module.exports = {
  theme,
  variants,
  plugins: Object.values(plugins).map((p) => plugin(p)),
  prefix: '_',
};
  1. Profit! ✨

Documentation 📚

Rainbow documentation is available at https://rainbow.otovo.com, and updated using the rainbow-documentation repo. Remember to update the documentation when making changes.

It is highly recommended to read the official Tailwind documentation, as this projects depend upon it heavily.

Development 👩🏼‍💻

To make it easier to test changes to rainbow-tailwind locally, you can set up a link to cloud or rainbow-documentation (or both). Linking the repo can be done as follows (assuming you have placed the repos in ~/projects):

cd ~/projects/rainbow-tailwind
yarn link

cd ~/projects/cloud
yarn link @otovo/rainbow-tailwind

Great! You're almost set. To rebuild the distribution whenever you change something, run...

yarn dev

Publishing 📦

To release a new version to NPM, run...

yarn release

The script will hold your hand through the rest of the process. Remember to use semantic versioning.

Rainbows everywhere

Using Tailwind with Rainbow in Cloud

To use rainbow-tailwind

In order to use tailwind with the raibow-tailwind, some classes name need to be adapted when you will have to code some UI using rainbow-tailwind

Prefix '_' to use Tailwind in Cloud:

To be able to use Tailwind classes, they need to be call with the prefix '_' For instance, if you want to set a fixed width, you will see in the Tailwind's documentation the following syntax:

<div class="w-8 ..."></div>

In cloud, you will have to write:

<div class="_w-8 ..."></div>

Responsive classes:

Rainbow has its own breakpoint delimiters. If you want to use the responsive classes described in Tailwind's documentation, you will have to use the matching syntax in Rainbow:

Tailwind Breakpoint prefixRainbow-tailwind equivalentMinimum width
s2368px
s3480px
smm640px
mdm2768px
m3960px
lgl1024px
xll21280px
2xll31536px

Font classes:

Font classes used in Rainbow are matching the ones used in Tailwind except text-base:

Taiwind classRainbow-tailwind class
text-base_text-md

Width:

Taiwind classRainbow-tailwind classProperties
w-_w-0width: 0px;
w-0.50.125 rem;
w-1_w-1width: 0.25rem;
w-1.5width: 0.375rem;
w-2_w-2width: 0.5rem;
w-2.5width: 0.625rem;
w-3_w-3width: 0.75rem;
w-3.5width: 0.875rem;
w-4_w-4width: 1rem;
w-5_w-5width: 1.25rem;
w-6_w-6width: 1.5rem;
w-7width: 1.75rem;
w-8_w-8width: 2rem;
w-9width: 2.25rem;
w-10_w-8width: 2.5rem;
w-11width: 2.75rem;
w-12_w-12width: 3rem;
w-14width: 3.5rem;
w-16_w-16width: 4rem;
w-20_w-20width: 5rem;
w-24_w-24width: 6rem;
w-28width: 7rem;
w-32_w-32width: 8rem;
w-36width: 9rem;
w-40_w-40width: 10rem;
w-44width: 11rem;
w-48_w-48width: 12rem;
w-52width: 13rem;
w-56_w-56width: 14rem;
w-60width: 15rem;
w-64_w-64width: 16rem;
w-72width: 18rem;
w-80_w-80width: 20rem;
w-96_w-96width: 24rem;
_w-11228rem
_w-12832rem
_w-16040rem
_w-19248rem
_w-22456rem
_w-25664rem
_w-32080rem
_w-38496rem
w-auto_w-autowidth: auto;
w-px_w-pxwidth: 1px;
w-1/2_w-1/2width: 50%;
w-1/3_w-1/3width: 33.333333%;
w-2/3_w-2/3width: 66.666667%;
w-1/4_w-1/4width: 25%;
w-2/4_w-2/4width: 50%;
w-3/4_w-3/4width: 75%;
w-1/5_w-1/5width: 20%;
w-2/5_w-2/5width: 40%;
w-3/5_w-3/5width: 60%;
w-4/5_w-4/5width: 80%;
w-1/6_w-1/6width: 16.666667%;
w-2/6_w-2/6width: 33.333333%;
w-3/6_w-3/6width: 50%;
w-4/6_w-4/6width: 66.666667%;
w-5/6_w-5/6width: 83.333333%;
w-1/12_w-1/12width: 8.333333%;
w-2/12_w-2/12width: 16.666667%;
w-3/12_w-3/12width: 25%;
w-4/12_w-4/12width: 33.333333%;
w-5/12_w-5/12width: 41.666667%;
w-6/12_w-6/12width: 50%;
w-7/12_w-7/12width: 58.333333%;
w-8/12_w-1/2width: 66.666667%;
w-9/12_w-8/12width: 75%;
w-10/12_w-10/12width: 83.333333%;
w-11/12_w-11/12width: 91.666667%;
w-full_w-fullwidth: 100%;
w-screen_w-screenwidth: 100vw;

Max-width:

Taiwind classRainbow-tailwind classProperties
max-w-0_w-max-0max-width: 0rem;
max-w-none_max-w-nonemax-width: none;
max-w-xs_max-w-80max-width: 20rem;
max-w-sm_max-w-96max-width: 24rem;
max-w-md_max-w-112max-width: 28rem;
max-w-lg_max-w-128max-width: 32rem;
max-w-xlmax-width: 36rem;
max-w-2xlmax-width: 42rem;
max-w-3xl_max-w-128max-width: 48rem;
max-w-4xl_max-w-224max-width: 56rem;
max-w-5xl_max-w-256max-width: 64rem;
max-w-6xlmax-width: 72rem;
max-w-7xl_max-w-320max-width: 80rem;
max-w-full_max-w-fullmax-width: 100%;
max-w-minmax-width: min-content;
max-w-maxmax-width: max-content;
max-w-prosemax-width: 65ch;
max-w-screen-sm?tbdmax-width: 640px;
max-w-screen-md?max-width: 768px;
max-w-screen-lg? tbdmax-width: 1024px;
max-w-screen-xlmax-width: 1280px;
max-w-screen-2xlmax-width: 1536px;

Min-width:

Taiwind classRainbow-tailwind classProperties
min-w-0_w-min-0min-width: 0rem;
_min-w-nonemin-width: none;
_min-w-80min-width: 20rem;
_min-w-96min-width: 24rem;
_minw-112min-width: 28rem;
_min-w-128min-width: 32rem;
_min-w-128min-width: 48rem;
_min-w-224min-width: 56rem;
_min-w-256min-width: 64rem;
_min-w-320min-width: 80rem;
min-w-full_min-w-fullmin-width: 100%;
_min-screenscreen: '100vw'

Height:

Taiwind classRainbow-tailwind classProperties
h-0_h-0height: 0px;
h-0.5height: 0.125rem;
h-1_h-1height: 0.25rem;
h-1.5height: 0.375rem;
h-2_h-2height: 0.5rem;
h-2.5height: 0.625rem;
h-3_h-3height: 0.75rem;
h-3.5height: 0.875rem;
h-4_h-4height: 1rem;
h-5_h-5height: 1.25rem;
h-6_h-6height: 1.5rem;
h-7height: 1.75rem;
h-8_h-8height: 2rem;
h-9height: 2.25rem;
h-10_h-10height: 2.5rem;
h-11height: 2.75rem;
h-12_h-12height: 3rem;
h-14height: 3.5rem;
h-16_h-16height: 4rem;
h-20_h-20height: 5rem;
h-24_h-24height: 6rem;
h-28height: 7rem;
h-32_h-32height: 8rem;
h-36height: 9rem;
h-40_h-40height: 10rem;
h-44height: 11rem;
h-48_h-48height: 12rem;
h-52_h-52height: 13rem;
h-56_h-56height: 14rem;
h-60height: 15rem;
h-64_h-64height: 16rem;
h-72height: 18rem;
h-80_h-80height: 20rem;
h-96_h-96height: 24rem;
h-auto_h-autoheight: auto;
h-px_h-pxheight: 1px;
h-1/2_h-1/2height: 50%;
h-1/3_h-1/3height: 33.333333%;
h-2/3_h-2/3height: 66.666667%;
h-1/4_h-1/4height: 25%;
h-2/4_h-2/4height: 50%;
h-3/4_h-3/4height: 75%;
h-1/5_h-1/5height: 20%;
h-2/5_h-2/5height: 40%;
h-3/5_h-3/5height: 60%;
h-4/5_h-4/5height: 80%;
h-1/6_h-1/6height: 16.666667%;
h-2/6_h-2/6height: 33.333333%;
h-3/6_h-3/6height: 50%;
h-4/6_h-4/6height: 66.666667%;
h-5/6_h-5/6height: 83.333333%;
h-full_h-fullheight: 100%;
h-screen_h-screenheight: 100vh;

Max-height:

Taiwind classRainbow-tailwind classProperties
max-h-0_max-h-0max-height: 0px;
max-h-0.5max-height: 0.125rem;
max-h-1_max-h-1max-height: 0.25rem;
max-h-1.5max-height: 0.375rem;
max-h-2_max-h-2max-height: 0.5rem;
max-h-2.5max-height: 0.625rem;
max-h-3_max-h-3max-height: 0.75rem;
max-h-3.5max-height: 0.875rem;
max-h-4_max-h-4max-height: 1rem;
max-h-5_max-h-5max-height: 1.25rem;
max-h-6_max-h-6max-height: 1.5rem;
max-h-7max-height: 1.75rem;
max-h-8_max-h-8max-height: 2rem;
max-h-9max-height: 2.25rem;
max-h-10_max-h-10max-height: 2.5rem;
max-h-11max-height: 2.75rem;
max-h-12_max-h-12max-height: 3rem;
max-h-14max-height: 3.5rem;
max-h-16_max-h-16max-height: 4rem;
max-h-20_max-h-20max-height: 5rem;
max-h-24_max-h-24max-height: 6rem;
max-h-28max-height: 7rem;
max-h-32_max-h-32max-height: 8rem;
max-h-36max-height: 9rem;
max-h-40_max-h-40max-height: 10rem;
max-h-44max-height: 11rem;
max-h-48_max-h-48max-height: 12rem;
max-h-52max-height: 13rem;
max-h-56_max-h-56max-height: 14rem;
max-h-60max-height: 15rem;
max-h-64_max-h-64max-height: 16rem;
max-h-72max-height: 18rem;
max-h-80_max-h-80max-height: 20rem;
max-h-96_max-h-96max-height: 24rem;
max-h-px_max-h-pxmax-height: 1px;
max-h-full_max-h-fullmax-height: 100%;
max-h-screen_max-h-screenmax-height: 100vh;

Min-height:

Taiwind classRainbow-tailwind classProperties
min-h-0_w-0min-width: 0rem;
_min-h-nonemin-width: none;
_min-h-80min-width: 20rem;
_min-h-96min-width: 24rem;
_min-h-112min-width: 28rem;
_min-h-128min-width: 32rem;
_min-h-128max-width: 48rem;
_min-h-224min-width: 56rem;
_min-h-256min-width: 64rem;
_min-h-320min-width: 80rem;
min-h-full_min-h-fullmin-width: 100%;
_min-screenscreen: '100vw'

MEMO: REM/PX equivalents 1rem = 16px by default

REMPIXELS
0rem0px
0.125 rem2px
0.25rem4px
0.375rem6px
0.5rem8px
0.625rem10px
0.75rem12px
0.875rem14px
1rem16px
1.25rem20px
1.5rem24px
1.75rem28px
2rem32px
2.25rem36px
2.5rem40px
2.75rem44px
3rem48px
3.5rem56px
4rem64px
5rem80px
6rem96px
7rem112px
8rem128px
9rem144px
10rem160px
12rem192px
13rem208px
14rem224px
15rem240px
16rem256px
18rem288px
20rem320px
24rem384px
28rem448px
32rem512px
40rem640px
48rem768px
56rem896px
64rem1024px

Colors:

use rainbow colors described at official Rainbow colors

Kitchen sink

You will find in installerweb a file named kitchen-sink.html that shows different rainbow components developped with Tailwind/Jinja2 : kitchen sink in installerweb

FAQs

Package last updated on 31 Jan 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc