GithubHelp home page GithubHelp logo

style's Introduction

Style

Style Canvas renders using CSS.

Installation

$ component install component/style

Example

body {
  font-size: 18px;
}
.progress {
  background: #fff;
}
.progress .percentage {
  color: #ddd;
}
style('.progress', 'background-color');
// => 'rgb(255, 255, 255)'

style('.progress .percentage', 'color');
// => 'rgb(221, 221, 221)'

style('.progress .percent', 'font-size');
// => '18px'

About

This component exists so that you can influence aspects of your Canvas renders using CSS, where style decisions belong. For details view this blog post.

Performance

Generating and computing styles for ~2000 unique selectors in chrome takes ~300ms, so be careful if you plan on using this for many unique selectors. Values are otherwise cached in an object and can easily operate above 300,000 ops/s.

License

MIT

style's People

Contributors

tj avatar forbeslindesay avatar jonathanong avatar

Stargazers

sharkshore avatar timelyportfolio avatar Michael Anthony avatar Paul Cookie avatar Gustavo Leguizamon avatar pepsin avatar 迁移到 leogiese avatar Harold Martin avatar Shawn Jonnet avatar Matias Meno avatar Nathan Rajlich avatar

Watchers

Julian Gruber avatar Dan Dascalescu avatar Roman Shtylman avatar Dominic Barnes avatar Qiming zhao avatar Dmitry Iv. avatar Benjamin Bertrand avatar timelyportfolio avatar James Cloos avatar Michael Anthony avatar Duncan Overbruck avatar  avatar

Forkers

swatinem ykankaya

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.