Giter VIP home page Giter VIP logo

create-chakra-icon-in-colors's Introduction

create-chakra-icon

Convert one or multiple svg files into inline-svg Chakra UI (React) Icon component. With colors being red from style fill properties. Forked from create-chakra-icon that is inspired by react-icons project.

If you are wondering what the benefit is to use inline svg in React component, please check this post Creating an SVG Icon System with React.

Installation

Clone this repo

Usage

$ create-chakra-icon ./alert.svg dist
$ create-chakra-icon ./*.svg dist

Result

Your source svg file mobile-menu-dark.svg:

<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 26.66 119.78"><defs><style>.cls-1{fill:#202990;}.cls-2{fill:#fc5501;}.cls-3{fill:#fcFF01;}</style></defs><g id="Layer_2" data-name="Layer 2"><g id="Layer_1-2" data-name="Layer 1"><path class="cls-1" d="M13.34,0A13.41,13.41,0,0,1,26.66,13.32,13.46,13.46,0,0,1,13.34,26.66,13.5,13.5,0,0,1,0,13.33,13.48,13.48,0,0,1,13.34,0Z"/><path class="cls-2" d="M26.64,59.84A13.3,13.3,0,1,1,0,59.67a13.23,13.23,0,0,1,13.27-13A13.21,13.21,0,0,1,26.64,59.84Z"/><path class="cls-3" d="M26.66,106.69a13.44,13.44,0,0,1-13.55,13.09,13.33,13.33,0,1,1,.46-26.66A13.48,13.48,0,0,1,26.66,106.69Z"/></g></g></svg>

Results in the output MobileMenuDark.js:

import React from "react";
import { Icon } from "@chakra-ui/react";
import { chakra } from "@chakra-ui/react";
const MobileMenuDark = (props) => (
  <Icon viewBox="0 0 26.66 119.78" {...props}>
    <path
      fill={props?.colors?.[0] ?? "#202990"}
      d={
        "M13.34,0A13.41,13.41,0,0,1,26.66,13.32,13.46,13.46,0,0,1,13.34,26.66,13.5,13.5,0,0,1,0,13.33,13.48,13.48,0,0,1,13.34,0Z"
      }
    />
    ,
    <path
      fill={props?.colors?.[1] ?? "#FF2990"}
      d={
        "M26.64,59.84A13.3,13.3,0,1,1,0,59.67a13.23,13.23,0,0,1,13.27-13A13.21,13.21,0,0,1,26.64,59.84Z"
      }
    />
    ,
    <path
      fill={props?.colors?.[2] ?? "#FFFF90"}
      d={
        "M26.66,106.69a13.44,13.44,0,0,1-13.55,13.09,13.33,13.33,0,1,1,.46-26.66A13.48,13.48,0,0,1,26.66,106.69Z"
      }
    />
  </Icon>
);
export default chakra(MobileMenuDark);

How to use icons

import { MobileMenuDark } from "MobileMenuDark";

export default (props) => {
  return (
    <div>
      <MobileMenuDark boxSize="32" colors={["red", "blue", "teal"]} /> Manage my
      Collections
    </div>
  );
};

License

MIT

create-chakra-icon-in-colors's People

Contributors

dependabot-support avatar fraserxu avatar luke-j avatar peersky 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.