Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
};
let backgroundColors: string[] = [];
let isInternetExplorer =
options.userAgent &&
Bowser.getParser(options.userAgent).satisfies({
ie: '>0',
edge: '>0'
});
let isSafari =
options.userAgent &&
Bowser.getParser(options.userAgent).satisfies({
safari: '>0'
});
Object.keys(Color.collection).forEach((backgroundColor: keyof ColorCollection) => {
if (
options.backgroundColors === undefined ||
options.backgroundColors.length === 0 ||
options.backgroundColors.indexOf(backgroundColor) !== -1
) {
backgroundColors.push(Color.collection[backgroundColor][options.backgroundColorLevel]);
}
});
return function(random: Random) {
let backgroundColor = random.pickone(backgroundColors);
let seedInitials = (initials(random.seed.trim()) as string).toLocaleUpperCase().slice(0, options.chars);
let fontFamily = "-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif";
// prettier-ignore
return [
export default function(options: Options = {}) {
options = {
padding: 0,
background: '#FFF',
colorLevel: 600,
...options
};
let colors: string[] = [];
Object.keys(Color.collection).forEach((color: keyof ColorCollection) => {
if (options.colors === undefined || options.colors.length === 0 || options.colors.indexOf(color) !== -1) {
colors.push(Color.collection[color][options.colorLevel]);
}
});
return function(random: Random) {
let color = random.pickone(colors);
// prettier-ignore
return [
`<svg shape-rendering="crispEdges" version="1.1" viewBox="${0-options.padding} ${0-options.padding} ${5+options.padding*2} ${5+options.padding*2}" style="isolation:isolate" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg">`,
// Background
`<path fill="${options.background}" d="M${0-options.padding} ${0-options.padding}h${5+options.padding*2}v${5+options.padding*2}H${0-options.padding}V0z"></path>`,
// Row 1
random.pickone([
`<path fill="${color}" fill-rule="evenodd" d="M0 4h1v1H0V4zm4 0h1v1H4V4z"></path>`,</svg>
Object.keys(Color.collection).forEach((color: keyof ColorCollection) => {
if (options.colors === undefined || options.colors.length === 0 || options.colors.indexOf(color) !== -1) {
colorsCollection.push(Color.collection[color]);
}
});
Object.keys(Color.collection).forEach((backgroundColor: keyof ColorCollection) => {
if (
options.backgroundColors === undefined ||
options.backgroundColors.length === 0 ||
options.backgroundColors.indexOf(backgroundColor) !== -1
) {
backgroundColors.push(Color.collection[backgroundColor][options.backgroundColorLevel]);
}
});
Object.keys(Color.collection).forEach((color: keyof ColorCollection) => {
if (options.colors === undefined || options.colors.length === 0 || options.colors.indexOf(color) !== -1) {
colors.push(Color.collection[color][options.colorLevel]);
}
});
textureChance: 50,
topChange: 100,
...options
};
const group = (random: Random, content: string, chance: number, x: number, y: number) => {
if (random.bool(chance)) {
return ``;
}
return '';
};
let colorsCollection: Array = [];
Object.keys(Color.collection).forEach((color: keyof ColorCollection) => {
if (options.colors === undefined || options.colors.length === 0 || options.colors.indexOf(color) !== -1) {
colorsCollection.push(Color.collection[color]);
}
});
return function(random: Random) {
let primaryColorCollection = random.pickone(colorsCollection);
let secondaryColorCollection = random.pickone(colorsCollection);
let primaryColor = new Color(primaryColorCollection[options.primaryColorLevel]);
let secondaryColor = new Color(primaryColorCollection[options.secondaryColorLevel]);
if (options.colorful) {
secondaryColor = new Color(secondaryColorCollection[options.secondaryColorLevel]);
}