Git Product home page Git Product logo

figma-plugin-color-system-utilities's People

Contributors

eli-crow avatar

Watchers

 avatar

figma-plugin-color-system-utilities's Issues

Define `ScaleNode` and `Scale`

ScaleNode

  • Has a name following this RegExp pattern after trimming.
  • Is a ChildrenMixin
  • Has one or more StopNode as children, defined as
    • Is a MinimalFillsMixin
    • Does not begin with . or _
    • Has numeric name after trimming

GenerateScaleOptions

Extract this information from the ScaleNode before acting on it.

interface LightnessScaleProperties {
  name: string;
  theme: string | null;
  min: number;
  max: number;
  keyLightest: string;
  keyBase: string;
  keyDarkest: string;
}

function generateLightnessScale(options: LightnessScaleProperties) {
  throw new Error("not implemented")
}

Interpreting ScaleNode

  • theme / scale are extracted from ScaleNode name match. (see RegExp pattern above)
    • theme is optional. If only the first match has a value, treat it as the scale's name
  • min and max interpreted based on the numeric values of the StopNode names. If all StopNodes have a name with a numberic value value...
    • if largest < 10: the scale is interpreted to be in the range [0, 1000], otherwise
    • if largest < 100: range is [0, 100], otherwise
    • if largest < 1000 is [0, 1000]
  • lightestColor and darkestColor are the lightest colors among StopNode that aren't pure white or black, respectively (since white and black are intrinsically devoid of hue or saturation information)

Scale and Stop

interface Stop {
  name: string;
  offset: number;   // in the range [0,1]
  color: RGB;
}

interface LightnessScale extends LightnessScaleProperties {
  stops: Stop[]
}

Generate scale from gradient

Element with gradient should have name like

  • [<folder> / ] <scale> [ / <stop-list>]
    • allow arbitrary whitespece
    • where <stop-list> is like {50, 100, 200, 300, 400, 500, 600, 700, 800, 900}
    • if is omitted, use {100, 200, 300, 400, 500, 600, 700, 800, 900}

Sample each stop value (normalized to the implied maximum power of 10 among all stop values) and create a style

Create a reference-gradient style and assign it to the element

Split off:

Swap: Color

Write a command with parameters

  • That allows a user to switch scales, while preserving stops.
  • The command should provide completions based on known scales.
  • It should allow free-form submission, that is treated as the top match among completions for more intuitive use.

Decisions

  • What is a "scale"?
  • How do we filter what to show in completions?

Named stops for scale stops

labeled stops can be specified like {lightest=50, 100, 200, ...}: the stop will be named as the identifier and treated as the number

Simplify scale configuration

Configuration mostly by naming convention

  • Reference scale: must be present, with a name matching /[._]?scale$/i
  • Base color: optional, but will be interpreted and generated if not present. name must match /[._]?(?:base|default|normal)$/i
  • Stops: a style in a folder containing a reference scale. Description must match /^([\d.])+%/. The style will sample the gradient at an offset of Number($1) / 100

Resolves #12
Resolves #5

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.