1.0.7 • Published 2 years ago

svg-color-light v1.0.7

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

get started

npm i svg-color-light

import { getColor, changeColor, strToDom, strToJson } from "svg-color-light"

example const

const svg = `
<style>
.a {
    fill: #333333
}
.b {
    fill: #222222
}
</style>
<svg height="100" width="100">
  <circle cx="50" cy="50" r="40" fill="#000000" />
  <circle cx="50" cy="50" r="40" fill="#000000" />
  <circle cx="50" cy="50" r="40" fill="#000001" />
</svg> 
`

get color from svg string

console.log(getColor(svg)) //output => [ '#333333', '#222222', '#000000', '#000001' ]

change color of svg string

const changedColor = changeColor(svg, [{from: '#333333', to: '#000'}])
console.log(changedColor) //output => new string svg
console.log(getColor(changedColor)) //output => [ '#000', '#222222', '#000000', '#000001' ]
1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago