Giter Club home page Giter Club logo

vivid's Introduction

Vivid.JS Logo

Check Beautiful Doc on Website.


Introduction

Vivid.JS is an SVG Icons library which can be used to add highly customizable vibrant icons to the DOM without any dev dependencies.

Vivid.JS is easy to adapt and can bring SVG icons to life using html5 data attributes on the go. Icons can also be individually customized in terms of colors and size using html5 data attributes which gives more power to Vivid.JS library.

Vivid.JS SVG Icons ca be download and customized as per needs in different designing softwares like Photoshop and Sketch as well.

Download Vivid.JS Icons for Sketch

Download Vivid.JS Icons for Photoshop

Getting Started

To get started with Vivid.JS, you just need to include vivid-icons.min.js to your project.

Installation

Compiled vivid-icons.min.js JavaScript minified file can be directly linked from jsDelivr or UNPKG CDN or Vivid.JS can be included within your workflow using your favorite package managers as well.

Link from jsDelivr (Recommended) or UNPKG CDN

You can include Vivid Icons JavaScript file in the header section of your document as shown below -

<script src="https://cdn.jsdelivr.net/npm/[email protected]" type="text/javascript"></script>

or

<script src="https://unpkg.com/[email protected]" type="text/javascript"></script>

Package Managers

You can use either npm, yarn or bower to get the Vivid.JS package

Copy and Paste the command below in your terminal to get package with npm -

npm install vivid-icons

Copy and Paste the command below in your terminal to get package with yarn -

yarn add vivid-icons

Copy and Paste the command below in your terminal to get package with bower -

bower install vivid-icons

Usage

Including icons with Vivid.JS is very easy and quick to use.

Using an Icon

An SVG Icon can be easily included using the syntax <i data-vi="icon-name"></i> , where icon-name is replaced by the unique name of the respective icon.

Example Code

<i data-vi="doc"></i>

Customizing Icon Size

To customize the size of the respective icon, Add data-vi-size="number" data attribute to i element to customize size of the icon.

Example Code

<i data-vi="doc" data-vi-size="96"></i>

Customizing Icon Colors

Each Vivid Icon has upto three colors which are primary, accent and prop. Each color can be customized respectively using data attributes.

Add data-vi-primary="#hexcode" data attribute to customize the primary color of the icon.

Add data-vi-accent="#hexcode" data attribute to customize the accent color of the icon.

Add data-vi-prop="#hexcode" data attribute to customize the prop color of the icon.

Example Code

<i data-vi="doc" data-vi-primary="#2B13C1" data-vi-accent="#00ECB1" data-vi-prop="#CEFAFF"></i>

Icon Customization

Oh! Yes, You can customize the default size and colors of the Vivid.JS SVG Icons Library.

Install Node.js

First of all you need to install the latest version of Node.js (if you don't have it pre-installed), once you are over with Node.js installation, open up terminal and verify everything has setup correctly by running npm -v and it should return with something like 5.x.x

Create your Project

  • Open terminal and create your project directory with mkdir project-name command.
  • Go to your project directory using cd project-name command.
  • Initialize your project by npm init command and enter the necessary details.

Install Vivid.JS Package

Install Vivid.JS SVG Icons Package with npm package manager using the command below -

npm install vivid-icons

Once, the vivid-icons is installed as a node module, go to node_modules/vivid-icons directory using cd node_modules/vivid-icons command and install vivid-icons dependencies with npm install.

Customize Icons

Go to src directory of the installed package and open config.js file.

config.js file looks like

export let iconConfig = { 
    size: "48", 
    primaryColor: "#FF6E6E", 
    accentColor: "#0C0058", 
    propColor: "#FFFFFF" 
 } 

Update the respective property values which needs to be changed.

Compile Vivid.JS Icons

Once you are done with updates in config.js head back to the terminal and run the following command -

npm run build

Voila! You're done

Once the compilation process is over, your browser will fire up to show the compiled Vivid SVG Icons in your browser from the ./dist/preview.html file.

If you are using Windows environment replace the "open-html": "open ./dist/preview.html" with "open-html": "show ./dist/preview.html" in package.json file.

Adding Icons

If you wish to create your very own Vivid.JS with your custom icons, Follow the steps below -

Once you have installed Vivid.JS, add/replace/remove the icons from ./icons directory

Make sure the SVG Icons which has been added must have vi-primary and vi-accent class to the respective SVG Elements, so that the colors can be customized later from src/config.js.

Example Code

<svg id="chat" xmlns="http://www.w3.org/2000/svg" width="48" height="48" viewBox="0 0 48 48">
    <defs>
        <style>
        .vi-primary {
            fill: #ffb400;
        }

        .vi-accent {
            fill: #070c2b;
        }
        </style>
    </defs>
    <path class="vi-primary" d="M24,39.765A18.556,18.556,0,0,1,13.924,37.1L7,44V23.882l0.012,0.006C7.011,23.791,7,23.7,7,23.6,7,14.369,13.247,8,24,8s17,6.652,17,15.882S34.753,39.765,24,39.765Z"/>   
    <path class="vi-accent" d="M31.994,20.99a3,3,0,1,1-3,3A3,3,0,0,1,31.994,20.99ZM24,21a3,3,0,1,1-3,3A3,3,0,0,1,24,21Zm-8,0a3,3,0,1,1-3,3A3,3,0,0,1,16,21Z"/>   
</svg>

Go to the root directory of vivid-icons and execute npm run build command from terminal.

Credits

© Copyright 2018 Webkul Software, All rights reserved.

vivid's People

Contributors

khagwal avatar kunjvns avatar webkul avatar

Stargazers

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

Watchers

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

vivid's Issues

Request Icon

Icon for Medical or First Aid or Ambulance, something related to Medical

Typescript offering

Hi,
I am using angular v6. How can I use your offering in Angular 6 where typescript is used, not javascript?

Cheers

Multimedia Icons

I propose the following icons:

  • Film icon
  • Video camera icon
  • Sound / audio (volume up / down / mute) icons
  • Music icon
  • Radio icon

Icons won't re-render on route change

I included vivid-icons in a Vue.js project which uses vue-router for navigation. The problem is that although the icons are rendered upon first load, when navigating to another route, icons won’t be rendered but the original markup (<i data-vi=”...” />) stays in place.

Is there a way to force re-rendering of vivid-icons?

A workaround I found, is to export the watchInjection function of src/inject.js and then call it every time from the mount callback of the Vue components. Although this works, I would prefer to have icons somehow automatically re-rendered when it is needed.

Thank you for this library, nice work.

CSS variables in color data attributes work!

Using standard CSS variables var(--your-varible-name) in the primary and secondary data attributes works.

Might be helpful to include this tip in the documentation as it makes swapping colors globally for icons in a non-destructive manner possible, without editing the Vivid Icon source in node_modules/vivid-icon/src/config.js and then rebuilding from source every time a change is made.

Example for those unfamiliar with CSS variables:
<i data-vi="flame" data-vi-size="90" data-vi-primary="var(--primary)" data-vi-accent="var(--secondary)" data-vi-prop="var(--tertiary)"></i>

Then, set up your variables:
:root { --primary: #010101; --secondary: #333; --tertiary: #dbdbdb; }

And that's it! Hope this helps someone.

Problem with dynamically added icons

I have a problem with dynamically added icons -> they don't show, check the following example:

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
  <script src="https://code.jquery.com/jquery-3.1.0.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/[email protected]" type="text/javascript"></script>
</head>
<body>
  <p>Here is a bag</p>
  <i data-vi="bag"></i>
  <p>Now add a box</p>
  <button id="add" type="button">Add a box</button>
  <script>
    
    $("#add").click(function(){
      $("body").append("<p>added, but where it is?</p>");
      $("body").append('<i data-vi="bag"></i>');
    });
    
  </script>
</body>
</html>

Is there a way to make this working?

Thanks

ie 11 support

I saw a bug that you don't support ie 11?

If that is so, you should list that in docs.

Also, yes, in ie 11 it fails due to 'forEach'

Customize icon colors outside of package

Hi!

Wouldn't it be better to be able to change the colors outside the package?
This way, when someone else installs a project with Vivid.js, the colors aren't lost.

Icons not displayed in IE/Older versions of iOS Safari

First: Great project. I been looking to use SVG allot more for icons and this is great for me - so: THANK YOU. 👍

Just FYI - I'm not sure if you are already aware of this. Your showcase website does not actually render the icons to the page under IE (11) or older versions of iOS safari. In IE, I can see the <i/> tags in the page, which implies that your code did not replace them with the corresponding SVG image.

For the record: they DO display fine in IE11 when the SVG is inserted.

My guess is your inject.js file - it assumes that querySelectorAll() returns an Array, because right after you attempt to use the forEach() method:

vividNode.forEach(function (item, key) {

Idea icon

Icon with some bubbles on its top

Info icon

Would be nice to have one of those little i information icons

Issues displaying multiple of the same icon?

I have two of the "arrow-left" icons serving as Go Back links. I have one at the top and one at the bottom of the page.
Only the bottom icon is displaying, the top icon is vanishing with the entire tag disappearing in the HTML code. It appears that no matter how many of the same icon I put on the page, only the last rendered icon actually displays.
I am loading the code from your CDN, and each icon is identical in size and colour. No errors are being logged to console.

Link Icon

An icon that illustrates a linked article, such as a link of a chain.

Social Media Icons

I propose the following social media icons:

  • Facebook
  • Twitter
  • Instagram
  • Google +
  • Youtube
  • Vimeo
  • Tumblr
  • Snapchat
  • Reddit
  • Pinterest

RSS Icon

Hi !
First of all: thanks for all those awesome icons.

What do you think about adding a 'RSS Feed' icon ?

Cheers,

ClassName CSS hook

Thanks for this icon set, the icons have proven to be well structured and easy to use.

One of the advantages of SVG's is that one can customize them with CSS for things like interactions (hover/click) and even animations. By being able to specify a className directly on the SVG, one does not have to wrap icons with an additional element.

Something like this would work great in my opinion:

<i data-vi="doc" data-class="vjs-icon"></i>

So that I can use CSS to customize all icons at once:

.vjs-icon .vi-primary {
  fill: blue;
}

Additionally this should also be configurable in config.js:

export let iconConfig = { 
   className: "vjs-icon"
} 

Curious to hear your thoughts for my proposal. I'd be happy to contribute to this feature.

Medical Icons

Hi,
Significant packages of medical icons in svg are currently lacking. It is a very broad category, but I think it could pay for itself.

If you include this package, many of us would purchase such a package for use.

NB. I did not put specific icons because of the shear numbers that would be required for such a venture. If you are embarking on it, I would be happy to give some advice/collaborate with you as to expectations, types etc.

Please let me know what you think.

Cheers

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.