Giter VIP home page Giter VIP logo

svg-labels's People

Contributors

bhousel avatar dependabot[bot] avatar jameskingdom avatar

Stargazers

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

Watchers

 avatar  avatar

svg-labels's Issues

Fix the fixtures

Tests are failing because the fixtures are built for the old-style labels (see #15)

Guess at fgcolor

GitHub will set the text color either dark or light based on the lightness of the background color, and we should do it too.

Don't cheat at strokes

This is a nitpicky issue, and maybe we won't change it, but - the outline stroke this library creates is not exactly like the one that the GitHub labels have.

GitHub label:

screenshot 2017-05-02 12 11 53

This library:

screenshot 2017-05-02 12 19 07

The issue is:

A 1px inset box shadow in CSS is not the same as a 1px outline stroke in SVG. SVG strokes are placed along the centerline, not at the inset. You can see by making the label very big that the stroke spills out over the edge of the label:

screenshot 2017-05-02 12 22 43

This is really not a big deal, but we could fix this by drawing a separate SVG path where the inset should be.

Or we could do nothing and just wait until the SVG Strokes specification is approved and supported in browsers.

Unicode in string breaks width calculation

Certain unicode (e.g. emoji) in the text string breaks the width calculation, causing the generated SVG to have NaN width. ๐Ÿ™€

Input:

http://labl.es/svg?text=scream%20cat%20%F0%9F%99%80

Output:

<svg xmlns="http://www.w3.org/2000/svg" width="NaN" height="20">
<rect width="NaN" height="20" rx="2" ry="2" fill="#ee0701" stroke="#273135" stroke-width="1" stroke-opacity="0.12" stroke-linejoin="round"/>
<text x="NaN" y="14" fill="#fff" text-anchor="middle" font-family="Helvetica,Arial" font-size="12" font-weight="600">scream cat ๐Ÿ˜ฑ</text></svg>

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.