Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

itty-chroma

Package Overview
Dependencies
Maintainers
0
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

itty-chroma

Powerful styling for the browser console in under 500 bytes.

  • 0.1.14
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
12
decreased by-85.54%
Maintainers
0
Weekly downloads
 
Created
Source

itty-chroma

Version Bundle Size Coverage Status Issues Discord

v1 Documentation  |   Discord


Powerful styling for the browser console in under 500 bytes.

Features

  • Tiny. It's an itty library, after all.
  • Made specifically for the browser console.
  • Loads of styling options, with infinite combinations.
  • Simple and powerful API, designed for ease & readability.

Example

import { chroma } from 'itty-chroma'


// you can keep it simple...
chroma.red.bold.underline.log('This is bold, red, underlined text')


// or go wild
const badge = chroma.padding('3px 6px').bg('#444').white.radius('0.3rem')
const description = chroma.italic.color('#666').size('0.9em')

chroma.log(
  badge('Did You Know?'),
  description,
  'this is now in smaller, italic text',
  'and so is this... until we switch styles again',
  chroma.none,
  'but this is back to normal!'
)

image

API

Chroma exposes an infinitely-chainable function/object, allowing you to chain styles.

You can also use chroma style definitions as arguments inside other chroma statements, allowing for reusable, composable styles.

PROPERTYDESCRIPTIONEXAMPLE(s)
.logonce executed, will output to console.logchroma.log('hello')
.warnonce executed, will output to console.warnchroma.warn('warning text')
.erroronce executed, will output to console.errorchroma.error('error text')
.boldbold textchroma.bold('this is bold'), chroma.bold.red('this is bold and red')
.italicitalicized textchroma.italic('this is italic')
.underlineunderlined textchroma.underline('text')
.striketext with a line through itchroma.strike('this text was removed')
.color(value)sets font color, supports any valid CSS colorchroma.color('white'), chroma.color('rgba(255,0,0,0.2)')
.font(value)sets font, supports any valid CSS font-familychroma.font('Georgia')
.size(value)sets font sizechroma.size('0.8rem')
.bg(value)sets background, supports any valid CSS backgroundchroma.bg('salmon')
.radius(value)sets border-radius (for badges)chroma.radius('4px')
.border(value)sets border stylechroma.border('double 5px red')
.padding(value)sets paddingchroma.padding('2px 5px')
.style(value)sets custom CSS, allowing any valid sequencechroma.style('text-transform:uppercase;text-shadow:0 0 0.5rem rgba(255,0,100,0.5)')

Keywords

FAQs

Package last updated on 16 Dec 2024

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