w3c / w3c/csswg-drafts

[css-images] [css-shapes] create simple fill-able/stroke-able CSS images

Open
#8,049 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

css-images-5
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

Possible solutions for creating simple fill-able/stroke-able CSS images have been mentioned here and there in other issues but I've not yet seen an issue specifically for this kind of conversation so this is that. These conversations seem to fall into 2 main categories:

  1. use <basic-shape> inside image()
  2. make SVG creation with CSS easier

use <basic-shape>

ex. fill and/or stroke a circle: a 45px diameter circle, filled with red and stroked with a 3px black line

background-image: image( circle(45px at 22.5px 22.5px, red, 3px black) );
background-position: center center;
background-repeat: no-repeat;
  • imagining the stroke to be added on the inside of the circle like border does in CSS by default?
  • options to fill/stroke with color, gradient, or gradient pattern??

other random thoughts

  • @image-manipulation would allow cutting shapes from gradient images with clip-path but being able to just create the shapes as images would skip a step for the browser.
  • does the current stripe proposal fall in here as well?
  • compositing shapes?

make a CSS like syntax for creating SVG images

https://yuanchuan.dev/experimenting-a-new-syntax-to-write-svg

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the two approaches outlined in this issue: using inside image() and making SVG creation easier with CSS-like syntax. Review the linked SVG syntax experiment and the questions about fill, stroke, gradients, patterns, and compositing. Done would require a settled direction and a sufficiently specified CSS proposal.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.