GithubHelp home page GithubHelp logo

showvariables.css's Introduction

showVariables.css

showVariables.mov

CSS Variable-based Card Creation Project

This repository contains a JavaScript for creating HTML cards with information extracted from CSS variables :root Documentation.

Features

  • Creating HTML cards from CSS variables
  • Handling various categories of CSS variables (color, font-family, font-weight, font-size, border, shadow)
  • Adapting text and styles according to CSS variables
  • Displaying cards within an HTML container

How to use

  1. Clone the repository
  2. Open the index.html file in your browser
  3. Cards with the information from the CSS variables will be generated automatically
  4. Add your :root palette in root.css & modify root.json

Main code

The main file of this project is script.js. Here's an overview of what each function does in this file:

  • createCard(variable): Creates an HTML card with information extracted from a CSS variable.
  • colorIsLight(color): Checks if a color is light or dark.
  • fetch("root.json"): Fetches JSON data containing categories and CSS variables from an external file.

Example JSON data

The root.json file contains information about categories and CSS variables. Here's an example structure for this file:

{
  "categories": [
    {
      "title": "Colors",
      "variables": [
        { "name": "--primary-color", "type": "color" }
      ]
    }
  ]
}

showvariables.css's People

Contributors

babyloopro avatar

Watchers

 avatar

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.