Code Monkey home page Code Monkey logo

unocss-preset-heropatterns's Introduction

unocss-preset-hero-patterns

๐Ÿ UnoCSS preset that integrates Hero Patterns

Installation

pnpm add -D @julr/unocss-preset-heropatterns

Usage

import { defineConfig } from 'unocss'
import { presetHeroPatterns } from '@julr/unocss-preset-heropatterns'

export default defineConfig({
  presets: [
    presetHeroPatterns()
  ],
})

This preset add 2 rules

bg-hero-${patternName}-${color}

It works in a similar way to the tailwind/windicss plugin for heropatterns, it provides patternName with the color color as a background-image; color can be any valid unoCSS color pattern, so it is possible to directly control also the opacity with it; some examples:

<div class="bg-hero-rain-red-500"></div> <!-- this will render the rain pattern with color red-500 -->
<div class="bg-hero-rain-red-500/70"></div> <!-- this will render the rain pattern with color red-500 and 70% opacity -->
<div class="bg-hero-rain-[#fff]"></div> <!-- this will render the rain pattern with color #fff -->
<div class="bg-hero-rain-white-500 bg-dark-500"></div> <!-- it is also possible to combine it with a background color -->

bg-mask-hero-{patternName}

We use mask-image to display the patterns, so to change the color of the pattern, its opacity, or the background color, you can use the classes you are used to, for example :

<div class="bg-mask-hero-rain bg-red-500 opacity-70"></div>

List of patterns

  • "jigsaw"
  • "overcast"
  • "formal-invitation"
  • "topography"
  • "texture"
  • "jupiter"
  • "architect"
  • "cutout"
  • "hideout"
  • "graph-paper"
  • "yyy"
  • "squares"
  • "falling-triangles"
  • "piano-man"
  • "pie-factory"
  • "dominos"
  • "hexagons"
  • "charlie-brown"
  • "autumn"
  • "temple"
  • "stamp-collection"
  • "death-star"
  • "church-on-sunday"
  • "i-like-food"
  • "overlapping-hexagons"
  • "four-point-stars"
  • "bamboo"
  • "bathroom-floor"
  • "cork-screw"
  • "happy-intersection"
  • "kiwi"
  • "lips"
  • "lisbon"
  • "random-shapes"
  • "steel-beams"
  • "tiny-checkers"
  • "x-equals"
  • "anchors-away"
  • "bevel-circle"
  • "brick-wall"
  • "fancy-rectangles"
  • "heavy-rain"
  • "overlapping-circles"
  • "plus"
  • "rounded-plus-connected"
  • "volcano-lamp"
  • "wiggle"
  • "bubbles"
  • "cage"
  • "connections"
  • "current"
  • "diagonal-stripes"
  • "flipped-diamonds"
  • "floating-cogs"
  • "glamorous"
  • "houndstooth"
  • "leaf"
  • "lines-in-motion"
  • "moroccan"
  • "morphing-diamonds"
  • "rails"
  • "rain"
  • "skulls"
  • "squares-in-squares"
  • "stripes"
  • "tic-tac-toe"
  • "zig-zag"
  • "aztec"
  • "bank-note"
  • "boxes"
  • "circles-squares"
  • "circuit-board"
  • "curtain"
  • "diagonal-lines"
  • "endless-clouds"
  • "eyes"
  • "floor-tile"
  • "groovy"
  • "intersecting-circles"
  • "melt"
  • "overlapping-diamonds"
  • "parkay-floor"
  • "pixel-dots"
  • "polka-dots"
  • "signal"
  • "slanted-stars"
  • "wallpaper"

License

MIT License ยฉ 2022 Julien Ripouteau

unocss-preset-heropatterns's People

Contributors

julien-r44 avatar wonderbeel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

wonderbeel

unocss-preset-heropatterns's Issues

Usage with CSS variables/themes?

I'm having some troubles getting unocss-preset-heropatterns to work with themes from https://github.com/Dunqing/unocss-preset-theme .

Is there any way to use it with themes/CSS variables?

works:

background-image: url(data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='rgb(191,219,254)' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E);

doesn't work:

background-image: url("data:image/svg+xml,%3Csvg width='40' height='40' viewBox='0 0 40 40' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='rgb(var(--un-preset-theme-colors-primary-200))' fill-opacity='1' fill-rule='evenodd'%3E%3Cpath d='M0 40L40 0H20L0 20M40 40V20L20 40'/%3E%3C/g%3E%3C/svg%3E");

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.