GithubHelp home page GithubHelp logo

mpopv / drawline Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 2.0 10 KB

A Sass mixin that lets you generate inline SVG background images by drawing a line with an ASCII art syntax similar to grid-template-areas

License: MIT License

CSS 100.00%
mixins scss sass sass-mixins svg svg-icons css drawline shape ascii-art

drawline's Introduction

Three shapes generated by drawline: a thunderbolt, a greater-than sign, and a blocky backwards c

drawline

npm NPM npm Libraries.io dependency status for latest release

A Sass mixin that generates inline SVG background images by drawing a line with an ASCII art syntax. Ideal for generating simple decorative shapes like chevrons or arrows.

Play with some examples: https://codepen.io/mpopv/pen/wXpgaL

Installation

npm i -D drawline
# or
yarn add -D drawline

Usage

@import '../../node_modules/drawline/drawline';

// A right-facing chevron
.right-chevron {
  background-image: drawline(
    ('-1---' // A Sass list of ASCII art strings
     '-----'
     '---2-'
     '-----'
     '-3---'),
    #000,    // The stroke color of the line
    10,      // The stroke-width of the line (as a percent of the image width, because viewBox is `0 0 100 100`)
    miter,   // The stroke-linejoin of the line
    square,  // The stroke-linecap of the line
    false    // Whether the last point should connect to the first (i.e. `<polyline>` vs `<polygon>`)
  );
}

drawline's People

Contributors

mpopv avatar

Stargazers

 avatar

Watchers

 avatar

drawline's Issues

Single map arg

Merge with defaults via this or similar, to avoid requiring specific argument order.

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.