mirror of
https://github.com/lens-protocol/core.git
synced 2026-01-10 14:48:15 -05:00
misc: SVG prepared for traits and mushroom fixed
This commit is contained in:
@@ -32,7 +32,20 @@ library Headwear {
|
||||
ICECREAM
|
||||
}
|
||||
|
||||
function getHeadwear(uint256 seed, bool isGold) public pure returns (string memory) {
|
||||
enum HeadwearColors {
|
||||
NONE,
|
||||
GREEN,
|
||||
LIGHT,
|
||||
DARK,
|
||||
PURPLE,
|
||||
BLUE,
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getHeadwear(
|
||||
uint256 seed,
|
||||
bool isGold
|
||||
) public pure returns (string memory, HeadwearVariants, HeadwearColors) {
|
||||
// We don't do +1 here to make icecream rare
|
||||
HeadwearVariants variant = HeadwearVariants(
|
||||
Helpers.getVariant(seed, Helpers.ComponentBytes.HEADWEAR) % (uint8(type(HeadwearVariants).max))
|
||||
@@ -44,7 +57,7 @@ library Headwear {
|
||||
}
|
||||
|
||||
if (variant == HeadwearVariants.NONE) {
|
||||
return '';
|
||||
return ('', HeadwearVariants.NONE, HeadwearColors.NONE);
|
||||
} else if (variant == HeadwearVariants.BEANIE) {
|
||||
HeadwearBeanie.BeanieColors beanieColor = isGold
|
||||
? HeadwearBeanie.BeanieColors.GOLD
|
||||
@@ -86,7 +99,7 @@ library Headwear {
|
||||
} else if (variant == HeadwearVariants.SPARKLES) {
|
||||
return
|
||||
HeadwearSparkles.getSparkles(
|
||||
isGold ? HeadwearSparkles.SparklesColors.GOLD : HeadwearSparkles.SparklesColors.WHITE
|
||||
isGold ? HeadwearSparkles.SparklesColors.GOLD : HeadwearSparkles.SparklesColors.LIGHT
|
||||
);
|
||||
} else if (variant == HeadwearVariants.CROWN) {
|
||||
HeadwearCrown.CrownColors crownColor = isGold
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearBeanie {
|
||||
enum BeanieColors {
|
||||
GREEN,
|
||||
@@ -12,13 +14,18 @@ library HeadwearBeanie {
|
||||
|
||||
// // we take the 12th byte from the left for beanie color
|
||||
// uint8 color = uint8((seed >> 160) & 0xFF) % 4;
|
||||
function getBeanie(BeanieColors beanieColor) external pure returns (string memory) {
|
||||
return
|
||||
function getBeanie(
|
||||
BeanieColors beanieColor
|
||||
) external pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none"><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M98 66.5s4.2-.5 7-.5c2.6 0 6.8.5 6.8.5"/>',
|
||||
_getBeanieStyle(beanieColor),
|
||||
'<path class="beanieColor" d="M70.6 93c.2 0 .3 0 .4.2l-.3.7a10.6 10.6 0 0 0-3.5 10.1l-.3.8c-2.4-1.4-4.7-3-6.8-4.7-.5-4.4 1-8.8 4-11.3l.2.3c2 1.5 4.1 2.7 6.3 3.9Z"/><path class="beanieColor" d="M81 97.3c-2 3.4-3 7.4-3 11.4l-.2 1c-3.8-1.3-7.4-3-10.8-5l.3-.8a11 11 0 0 1 3.5-10.3l.3-.8c3.2 1.6 6.5 3 9.9 4v.5Z"/><path class="beanieColor" d="m81.2 96.8 2.7.7a72 72 0 0 0 8.1 1.6l-.1 1.4-1 11.5v.8a73 73 0 0 1-12.9-3.3l.3-1c0-4 1-8 2.8-11.2v-.5ZM105 100.6v13.2c-4.6 0-9.3-.3-14-1l.1-.8 1-11 .1-1.2c4.2.5 8.5.8 12.8.8ZM119 112v.7c-4.7.7-9.4 1-14 1v-13c4.3 0 8.6-.3 12.8-1l.2 1.4 1 11ZM131.7 108.5l.3 1a73.2 73.2 0 0 1-12.8 3.3l-.1-.7-1-11.6-.1-1.4a77 77 0 0 0 10.8-2.3v.5c2 3.3 3 7.2 3 11.2Z"/><path class="beanieColor" d="M143 104.7a60 60 0 0 1-10.7 5l-.3-1c0-4-1-8-2.9-11.3l-.1-.6c3.4-1 6.8-2.4 10-4l.3.8a11 11 0 0 1 3.4 10.4l.3.7Z"/><path class="beanieColor" d="M146 88.8c2.9 2.5 4.4 6.9 4 11.3a51.8 51.8 0 0 1-7 4.7l-.2-.7c.7-3.8-.7-8-3.5-10.2l-.3-.7.3-.2c2.3-1.2 4.4-2.4 6.4-3.9l.3-.3Z"/><path class="beanieColor" d="M145.6 89.2c-2 1.3-4.2 2.4-6.4 3.4l-.4-.9c.3-7.8-2-15.7-6.7-22a34.5 34.5 0 0 0-16.5-12.4 40.2 40.2 0 0 1 17 7.8c7 6 11.8 14.8 13.2 23.9l-.2.2Z"/><path class="beanieColor" d="m138.8 91.7.4 1h-.3a66.8 66.8 0 0 1-12.8 4.1l-.1-.6c.6-14.3-5-28.6-14.3-39.6a44.7 44.7 0 0 1 4 .7c6.5 2 12.7 7.2 16.4 12.3 4.6 6.4 7 14.3 6.7 22.1Z"/><path class="beanieColor" d="M104.7 56.2c2.4 0 4.7.2 7 .4 9.3 11 15 25.3 14.3 39.6v.6a91.2 91.2 0 0 1-21.3 2.2V56.2ZM104.7 99a105.1 105.1 0 0 1-21-2.1l.2-.7c-.7-14.4 5-28.6 14.3-39.6 2.1-.3 4.3-.4 6.5-.4V99Z"/><path class="beanieColor" d="m83.7 96.9-2.7-.7c-3.5-.9-6.8-2-10-3.4l-.4-.2.5-.9c-.3-7.8 2-15.7 6.6-22A34 34 0 0 1 95 57l3.3-.5c-9.3 11-15 25.2-14.3 39.6l-.2.7Z"/><path class="beanieColor" d="M77.7 69.6c-4.6 6.4-7 14.3-6.6 22.1l-.5 1c-2.2-1-4.3-2.2-6.3-3.5L64 89A39.8 39.8 0 0 1 77.3 65a34.6 34.6 0 0 1 17.6-8 34 34 0 0 0-17.2 12.5Z"/><path class="hwline4" d="M85.7 59.7c-3 1.4-5.7 3.2-8.3 5.5a42.7 42.7 0 0 0-13.3 25.2 11.7 11.7 0 0 0-4 10.5 57.4 57.4 0 0 0 17.8 8.8 81.3 81.3 0 0 0 27.1 4 96.2 96.2 0 0 0 27.1-4A65.1 65.1 0 0 0 150 101c.5-4.1-1-8.2-4-10.5a42.7 42.7 0 0 0-13.3-25.2c-2.6-2.3-5.3-4-8.3-5.5"/><path class="hwline4" d="M64.3 89.2c2 1.3 4.1 2.4 6.3 3.4l.4.2a66.5 66.5 0 0 0 21 5.5c4.2.5 8.5.7 12.7.7"/><path class="hwline3" d="M71 93.8a9.9 9.9 0 0 0-3.8 10M81 96.8c-2 3.2-3 7.1-3 11M92 99.8l-1 11M98.4 56.4s0 0 0 0l-.2.2c-9.3 11-15 25.2-14.3 39.6"/><path class="hwline3" d="M71 91.7c-.3-7.8 2.1-15.7 6.7-22A34 34 0 0 1 95 57c1.2-.4 2.3-.6 3.5-.7"/><path class="hwline4" d="M145.6 89.2c-2 1.3-4.2 2.4-6.4 3.4l-.3.2a66.8 66.8 0 0 1-21 5.4c-4.5.6-8.9.8-13.2.8h0"/><path class="hwline3" d="M139 93.8c3 2.1 4.6 6.3 3.8 10M129 96.8c2 3.2 3 7.1 3 11M118 99.8l1 11M111.4 56.4s0 0 0 0l.3.2c9.3 11 15 25.3 14.3 39.6"/><path class="hwline3" d="M138.8 91.7c.3-7.8-2-15.7-6.7-22a34.5 34.5 0 0 0-16.5-12.4s0 0 0 0c-1.4-.5-2.8-.8-4.1-.9M105 55.8v57"/><path fill="white" d="m116.5 62.3-11.5.5-10.5-.5s-6-3.7-9-2.4l-.2-.5a5 5 0 0 1 2.6-6.9 7 7 0 0 1 .4-7.5 7.4 7.4 0 0 1 7.4-2.5c1.1-3.2 5.8-4.7 9.3-4.7 3.4 0 8 1.5 9.1 4.7 2.9-.6 5.8.4 7.4 2.5a7 7 0 0 1 .5 7.5 5 5 0 0 1 2.5 7l-.2.5c-2.7-1.2-7.8 2.3-7.8 2.3Z"/><path class="hwline4" d="M85.3 59.4a5 5 0 0 1 2.6-6.9 7 7 0 0 1 .4-7.5 7.4 7.4 0 0 1 7.4-2.5c1.1-3.2 5.8-4.7 9.3-4.7 3.4 0 8 1.5 9.1 4.7 2.9-.6 5.8.4 7.4 2.5a7 7 0 0 1 .5 7.5 5 5 0 0 1 2.5 7"/><path class="hwline3" d="M85.3 59.4s5.1 3.4 19.7 3.4c14.5 0 19.5-3.4 19.5-3.4"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.BEANIE,
|
||||
_getHeadwearColor(beanieColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getBeanieStyle(BeanieColors beanieColor) internal pure returns (string memory) {
|
||||
@@ -45,4 +52,20 @@ library HeadwearBeanie {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(BeanieColors beanieColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (beanieColor == BeanieColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (beanieColor == BeanieColors.LIGHT) {
|
||||
return Headwear.HeadwearColors.LIGHT;
|
||||
} else if (beanieColor == BeanieColors.DARK) {
|
||||
return Headwear.HeadwearColors.DARK;
|
||||
} else if (beanieColor == BeanieColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (beanieColor == BeanieColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearCrown {
|
||||
enum CrownColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearCrown {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getCrown(CrownColors crownColor) external pure returns (string memory) {
|
||||
return
|
||||
function getCrown(
|
||||
CrownColors crownColor
|
||||
) external pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getCrownStyle(crownColor),
|
||||
'<path class="crownColor1" d="M54.4 56.4a6 6 0 0 1-3.4 8 6 6 0 0 1-7.2-3.5 6 6 0 0 1 3-7.3 6 6 0 0 1 7.6 2.8Zm28.9 4.7v.1c-1.8.7-4 .2-5.4-1.2a5 5 0 0 1-.9-5.6 5 5 0 0 1 5-2.7 5 5 0 0 1 4.1 3.8c.4 2-.3 4.7-2.7 5.7Zm25.6-20.3a6.9 6.9 0 0 1 2.5 7.3c-.7 2.4-3 4.2-6 4.6l-.9.1a6.9 6.9 0 0 1-6-4.9c-.7-2.6.4-5.7 2.7-7.2a6.8 6.8 0 0 1 7.7 0Zm17.7 20.4c-2.4-1-3.1-3.7-2.7-5.7a5 5 0 0 1 4.1-3.8c2-.2 4 1 5 2.7a5 5 0 0 1-.9 5.6 5.1 5.1 0 0 1-5.4 1.2h-.1Zm36.5-7.6a6 6 0 0 1 3.1 7.3 6 6 0 0 1-7.2 3.4 5.8 5.8 0 0 1-3.4-7.9 6 6 0 0 1 7.5-2.8Z"/><path fill="#fff" d="M131.3 94.7a5 5 0 0 1-2.7 5.2 5 5 0 0 1-5.8-1.2 5.2 5.2 0 0 1-.7-5.9c.8-1.5 2.6-2.5 5-2.2 2.1.2 4 2 4.2 4Z"/><path class="crownColor2" d="M112.8 91c-2.4 2.6-5.2 4.8-7.8 7.1-2.6-2.3-5.4-4.5-7.8-7.1 2.3-3.6 5.3-6.8 7.8-10.2 2.5 3.4 5.5 6.6 7.8 10.2Z"/><path fill="#fff" d="M87.9 92.8c1 1.8.8 4.3-.6 5.9a5.2 5.2 0 0 1-5.9 1.2 5 5 0 0 1-2.7-5.2 5 5 0 0 1 4.2-4.1c2.4-.3 4.2.7 5 2.2Z"/><path class="crownColor1" d="M105.6 53.6a97.7 97.7 0 0 0 9.6 22.5c1.2 2.1 2.6 4.3 4.6 5.8 2 1.5 4.6 2.2 7.1 2.3 4 .2 7.8-1 11.2-3 3.4-1.9 6.5-4.4 9.5-6.8 3.7-3.1 7.5-6.2 11-9.6-4 14-9.2 27.5-15.9 40.6a187.2 187.2 0 0 1-37.1 2.5h-1.2c-13.3 0-24.7 0-37.1-2.5a229.4 229.4 0 0 1-16-40.6c3.6 3.4 7.4 6.5 11.1 9.6 3 2.4 6 5 9.5 6.8 3.4 2 7.3 3.2 11.2 3 2.5 0 5-.8 7-2.3 2-1.5 3.5-3.7 4.7-5.8 4-7 7.2-14 9.6-22.5l.1-.8h1v.8Zm23 46.3a5 5 0 0 0 2.7-5.2 5 5 0 0 0-4.2-4.1c-2.4-.3-4.2.7-5 2.2-1 1.8-.8 4.3.7 5.9 1.4 1.6 3.8 2 5.8 1.2ZM105 98c2.6-2.3 5.4-4.5 7.8-7.1-2.3-3.6-5.3-6.8-7.8-10.2-2.5 3.4-5.5 6.6-7.8 10.2 2.4 2.6 5.2 4.8 7.8 7.1Zm-17.7.6c1.4-1.6 1.6-4 .6-5.9-.8-1.5-2.6-2.5-5-2.2a5 5 0 0 0-4.2 4 5 5 0 0 0 2.7 5.3c2 .9 4.4.4 5.9-1.2Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M104.4 53.6a98.2 98.2 0 0 1-9.6 22.5 18.4 18.4 0 0 1-4.6 5.8c-2 1.5-4.6 2.2-7.1 2.3-4 .2-7.8-1-11.2-3-3.4-1.9-6.5-4.4-9.5-6.8-3.7-3.1-7.5-6.2-11-9.6 4 14 9.2 27.5 15.9 40.6C79.7 108 91 108 104.4 108"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M83.1 71.7a62 62 0 0 0 1.2-8.5s0 0 0 0h.1c2.4 1.6 6 3.6 8.8 4.3m-9.9-5.3c-1.8.7-4 .2-5.4-1.2a5 5 0 0 1-.9-5.6 5 5 0 0 1 5-2.7 5 5 0 0 1 4.1 3.8c.4 2-.3 4.7-2.7 5.7 0 0 0 0 0 0h0ZM51 64.3a6 6 0 0 1-7.2-3.4 6 6 0 0 1 3-7.3 6 6 0 0 1 7.6 2.8 6 6 0 0 1-3.4 8Zm53.5-11.5a6.9 6.9 0 0 1-6-4.9c-.7-2.6.4-5.7 2.7-7.2a6.8 6.8 0 0 1 7.7 0 6.9 6.9 0 0 1 2.5 7.4c-.7 2.4-3 4.2-6 4.6l-.9.1ZM82.9 90.6a5 5 0 0 0-4.2 4 5 5 0 0 0 2.7 5.3c2 .9 4.4.4 5.9-1.2 1.4-1.6 1.6-4 .6-5.9-.8-1.5-2.6-2.5-5-2.2Zm22.1-9.8c-2.5 3.4-5.5 6.6-7.8 10.2 2.4 2.6 5.2 4.8 7.8 7.1m.6-44.5a97.7 97.7 0 0 0 9.6 22.5c1.2 2.1 2.6 4.3 4.6 5.8 2 1.5 4.6 2.2 7.1 2.3 4 .2 7.8-1 11.2-3 3.4-1.9 6.5-4.4 9.5-6.8 3.7-3.1 7.5-6.2 11-9.6-4 14-9.2 27.5-15.9 40.6a187.2 187.2 0 0 1-37.1 2.5"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M125.6 63.2a30 30 0 0 1-8.7 4.2m10 4.3a62 62 0 0 1-1.2-8.5s0 0 0 0h-.1m1.1-1c1.8.7 4 .2 5.4-1.2a5 5 0 0 0 .9-5.6 5 5 0 0 0-5-2.7 5 5 0 0 0-4.1 3.8c-.4 2 .3 4.7 2.7 5.7h0v0s0 0 0 0h0Zm32.3 2.1a6 6 0 0 0 7.2-3.4 6 6 0 0 0-3-7.3 6 6 0 0 0-7.6 2.8 5.8 5.8 0 0 0 3.4 8Zm-31.9 26.3c2.1.2 4 2 4.2 4a5 5 0 0 1-2.7 5.3 5 5 0 0 1-5.8-1.2 5.2 5.2 0 0 1-.7-5.9c.8-1.5 2.6-2.5 5-2.2ZM105 80.8c2.5 3.4 5.5 6.6 7.8 10.2-2.4 2.6-5.2 4.8-7.8 7.1"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.CROWN,
|
||||
_getHeadwearColor(crownColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getCrownStyle(CrownColors crownColor) internal pure returns (string memory) {
|
||||
@@ -43,4 +50,18 @@ library HeadwearCrown {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(CrownColors crownColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (crownColor == CrownColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (crownColor == CrownColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (crownColor == CrownColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (crownColor == CrownColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearFloral {
|
||||
enum FloralColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearFloral {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getFloral(FloralColors floralColor) internal pure returns (string memory) {
|
||||
return
|
||||
function getFloral(
|
||||
FloralColors floralColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getFloralStyle(floralColor),
|
||||
'<path class="floralColor2" d="M170.3 62.5a9 9 0 0 1-3.6 15.2 9 9 0 0 1-8-1.6l-12.8 7.1c-2.8-.2-5.6.3-8.4 1.3 4.2-1.7 7.6-5.2 9.2-9.4l9.8-5c-.9-3.5.9-7.4 4-9 3.1-1.7 7.3-1 9.8 1.4ZM64.1 83.2l-12.8-7.1a9 9 0 0 1-8 1.5 9 9 0 0 1-5.7-5.4 9.3 9.3 0 0 1 2-9.7 9 9 0 0 1 9.9-1.4 8.2 8.2 0 0 1 4 9l9.8 5c1.6 4.2 5 7.7 9.2 9.4-2.8-1-5.6-1.5-8.4-1.3Z"/><path class="floralColor1" d="M67.6 93.7c.7-3.6 1.8-6.8 3.2-9.7a17.1 17.1 0 0 0-11.9.4 18.8 18.8 0 0 0-8.7 7.8c.6.2 2.9.2 8 3.2 5.2 3 8.7 7 8.7 7s0-5.2.7-8.7Zm74.7 0c-.6-3.5-1.7-6.8-3.2-9.7a20 20 0 0 1 6.8-.8c1.8.1 3.6.5 5.3 1.2 3.5 1.4 6.7 4.5 8.6 7.8-.6.2-2.9.2-8 3.2s-8.7 6.9-8.7 6.9-.1-5-.8-8.6ZM79.3 73a39.6 39.6 0 0 1 25.7-9c9.3 0 18.6 3 25.8 9 3.3 3 6.2 6.5 8.3 10.7a16.8 16.8 0 0 0 8.2-10.4c1.1-5-.4-10.6-4.2-14a14.6 14.6 0 0 0-15-2.4l2-3 8.2-12.4c4.7.5 8.6-3.3 9.5-7.3 1-4-1.3-8.4-5-10.2a9.4 9.4 0 0 0-11 2.6 8.6 8.6 0 0 0-.1 10.9l-9.5 14.9a19 19 0 0 0-17.2-9 19.4 19.4 0 0 0-17.2 9 1861 1861 0 0 1-9.5-15 8.7 8.7 0 0 0 0-10.8A9.4 9.4 0 0 0 67.1 24a9.4 9.4 0 0 0-5 10.2c.9 4 4.8 7.8 9.5 7.3L80 53.8l2 3.1a14.6 14.6 0 0 0-15 2.3 14.8 14.8 0 0 0-3.6 16c1.4 3.6 4.2 6.7 7.6 8.5 2.1-4.2 5-7.7 8.4-10.6Z"/><path class="floralColor2" d="m71.7 42.1 17.3 25 3.3-1.2 3.6-1L79 38.4v-1.8l1-6.2-2.9-6-5.4-1.5-4.9 1.5-4 4.3-1 4.7 2.4 5 7.5 3.8Zm66.3 0-17.3 25-3.2-1.2-3.6-1 16.8-26.6v-1.8l-.9-6.2 2.8-6 5.5-1.5 4.8 1.5 4 4.3 1.1 4.7-2.4 5-7.5 3.8Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M49.5 93.6s0 0 0 0a17.4 17.4 0 0 1 23-9 16.8 16.8 0 0 1-9.8-11.3c-1.2-5 .4-10.6 4.2-14a14.6 14.6 0 0 1 15-2.4m-8 11.5 5.5 5.8m-28.1 1.9 12.8 7.1"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M63.3 75.1s0 0 0 0l-9.8-5c.9-3.5-1-7.4-4-9a8.7 8.7 0 0 0-9.8 1.4 9.3 9.3 0 0 0-2.1 9.7 9 9 0 0 0 5.7 5.4 9 9 0 0 0 8-1.5m20.4-34.6L82 56.9l7.4 11.3"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="m96.7 66.3-9-14-9.4-14.8a8.7 8.7 0 0 0-.1-10.9 9.4 9.4 0 0 0-11-2.6 9.4 9.4 0 0 0-5 10.2c.9 4 4.8 7.8 9.5 7.3"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M87.8 52.4a19 19 0 0 1 17.2-9m0 9v13.2m55.5 28s0 0 0 0a17.4 17.4 0 0 0-23-9 16.8 16.8 0 0 0 9.7-11.3c1.2-5-.3-10.6-4.1-14a14.6 14.6 0 0 0-15-2.4m8 11.5-5.5 5.8m28.1 1.9-12.8 7.1"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="m146.7 75.1 9.8-5c-.9-3.5.9-7.4 4-9 3.1-1.7 7.3-1 9.8 1.4a9 9 0 0 1-3.6 15.2 9 9 0 0 1-8-1.6m-20.4-34.6L128 56.9l-7.5 11.3"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="m122.2 52.4 9.5-15a8.6 8.6 0 0 1 0-10.8 9.4 9.4 0 0 1 11.1-2.6 9.4 9.4 0 0 1 5 10.2c-.9 4-4.8 7.8-9.5 7.3m-25 24.8 9-14m-.1.1a19 19 0 0 0-17.2-9"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.FLORAL,
|
||||
_getHeadwearColor(floralColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getFloralStyle(FloralColors floralColor) internal pure returns (string memory) {
|
||||
@@ -43,4 +50,18 @@ library HeadwearFloral {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(FloralColors floralColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (floralColor == FloralColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (floralColor == FloralColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (floralColor == FloralColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (floralColor == FloralColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearGlasses {
|
||||
enum GlassesColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearGlasses {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getGlasses(GlassesColors glassesColor) internal pure returns (string memory) {
|
||||
return
|
||||
function getGlasses(
|
||||
GlassesColors glassesColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getGlassesStyle(glassesColor),
|
||||
'<path class="glassesColor1" d="M163.7 84.8a52.2 52.2 0 0 1-2 19.5c-1 2.6-2.1 5.2-3.6 7.5a31.5 31.5 0 0 1-22.3 14.6c-9.1 1.1-19-3-23.8-10.8-1.9-3-3.4-7.7-7-7.7s-5.1 4.6-7 7.7a25 25 0 0 1-23.8 10.8c-9.1-1-17.4-6.9-22.3-14.6a42.8 42.8 0 0 1-5.4-16c-.5-3.7-.5-7.4-.2-11h117.4ZM147 111.9c5.1-5 7.1-12.4 7.9-19.5-14.4-.4-29-.5-43.5-.5a24.3 24.3 0 0 0 11.4 22.7c7.5 4.3 18 3.4 24.2-2.7Zm-60 2.7c7.6-4.3 12-13.3 11.4-22.7-14.5 0-29.1 0-43.5.5.8 7.1 2.8 14.5 8 19.5 6.2 6 16.6 7 24.1 2.7Z"/><path fill="#000" fill-opacity=".5" d="M155 92.4a31.3 31.3 0 0 1-8 19.5c-6.2 6-16.6 7-24.1 2.7A24.3 24.3 0 0 1 111.5 92c14.6 0 29.1 0 43.5.5Zm-56.5-.5c.6 9.4-3.8 18.4-11.4 22.7A20.7 20.7 0 0 1 63 112c-5.1-5-7.1-12.4-7.9-19.5 14.4-.4 29-.5 43.5-.5Z"/><path class="glassesColor1" d="m49.6 101.3-.9.6-38.1 12.2c-1.3.5-2.6.9-4 .8-1.3 0-2.7-.7-3.3-1.9-.7-1.4 0-3.2 1-4.3a13 13 0 0 1 4.2-2.2c11.6-4.3 23.3-8.3 35-12.1l1.8-.8c1.2 2.7 2.6 5.3 4.3 7.7Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M46 93.8a971.8 971.8 0 0 0-37.5 12.7c-1.5.5-3 1.1-4.1 2.2-1.1 1.1-1.8 3-1 4.3.5 1.2 2 1.8 3.3 1.9 1.3 0 2.6-.3 3.9-.8l37.1-11.8"/><path class="glassesColor1" d="m160.4 101.3.9.6 38.1 12.2c1.3.5 2.6.9 4 .8 1.3 0 2.7-.7 3.3-1.9.7-1.4 0-3.2-1-4.3a11.2 11.2 0 0 0-4.2-2.2 939.7 939.7 0 0 0-35-12.1l-1.8-.8a42.8 42.8 0 0 1-4.3 7.7Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M164 93.8a1069 1069 0 0 1 37.5 12.7c1.5.5 3 1.1 4.1 2.2 1.1 1.1 1.8 3 1 4.3-.5 1.2-2 1.8-3.3 1.9-1.3 0-2.6-.3-3.9-.8l-37.1-11.8M105 84.8H46.3a52.2 52.2 0 0 0 2.1 19.5 31.4 31.4 0 0 0 25.8 22.1c9.1 1.1 19-3 23.8-10.8 1.9-3 3.4-7.7 7-7.7"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M98.5 91.9c-14.5 0-29.1 0-43.5.5.8 7.1 2.8 14.5 8 19.5 6.2 6 16.6 7 24.1 2.7 7.6-4.3 12-13.3 11.4-22.7Zm6.5-7.1h58.7a52.2 52.2 0 0 1-2 19.5c-1 2.6-2.1 5.2-3.6 7.5a31.5 31.5 0 0 1-22.3 14.6c-9.1 1.1-19-3-23.8-10.8-1.9-3-3.4-7.7-7-7.7"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M111.5 91.9c14.6 0 29.1 0 43.5.5a31.3 31.3 0 0 1-8 19.5c-6.2 6-16.6 7-24.1 2.7A24.3 24.3 0 0 1 111.5 92Z"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.GLASSES,
|
||||
_getHeadwearColor(glassesColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getGlassesStyle(GlassesColors glassesColor) internal pure returns (string memory) {
|
||||
@@ -43,4 +50,18 @@ library HeadwearGlasses {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(GlassesColors glassesColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (glassesColor == GlassesColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (glassesColor == GlassesColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (glassesColor == GlassesColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (glassesColor == GlassesColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearHat {
|
||||
enum HatColors {
|
||||
GREEN,
|
||||
@@ -13,13 +15,18 @@ library HeadwearHat {
|
||||
|
||||
// // we take the 13th byte from the left for hat color
|
||||
// uint8 color = uint8((seed >> 152) & 0xFF) % 5;
|
||||
function getHat(HatColors hatColor) internal pure returns (string memory) {
|
||||
return
|
||||
function getHat(
|
||||
HatColors hatColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getHatStyle(hatColor),
|
||||
'<path class="hatLine" stroke-width="4" d="M98 66.5s4.2-.5 7-.5c2.6 0 6.8.5 6.8.5"/><path class="hatColor1" d="m153.6 113-.8 2.6-3.3-.8-5.3-4.2-7.8-5-9.2-4.9-9.1-1-10.6-1h-10l-11 2L77 104l-10.6 5.2-8 6.5-2-.8 3-5.7.8-4.2 2.5-3.2 7.1-4.1 8.4-3.6 13.1-3.3 14.6-.9h10.3l23.3 6.8 8.1 5 2 4 4.1 7.4Z"/><path class="hatColor2" d="m62.5 90.8-2.2 13.8 3.5-3c3-2.4 6.2-4.4 9.6-5.9l1.3-.5 7.2-2.6 7.2-1.9 3.2-.5a91 91 0 0 1 13-.9h4c5.4.4 10.8 1.2 16 2.5l1 .2 8.9 3 3.2 1.5c3.3 1.6 6.2 3.7 8.9 6.2l2.2 1.9-1.9-13.8-2-7.8a30.6 30.6 0 0 0-5-10.9l-.6-.7c-2-2.8-4.4-5.2-7-7.4l-.3-.2c-2.4-2-5-3.6-7.8-5l-1.1-.5a37.2 37.2 0 0 0-16.3-3.7H102.8a36.9 36.9 0 0 0-15 3.2l-1.9.8a39.4 39.4 0 0 0-15.1 12L69.6 72a29.2 29.2 0 0 0-5.1 10.8l-2 8Z"/><path fill="#000" fill-opacity=".1" d="m66.2 99.9-6.1 5.9 2.3-14.2 2.6-8.8 4.4-9.4L80.5 62s-8.4 10.6-11 17.5c-3.6 9.2-3.3 20.4-3.3 20.4ZM143.9 98.9l6 5.9-2.3-14.2-2.6-8.8-4.4-9.4-11-11.4s8.3 10.6 11 17.5C144.1 87.7 144 99 144 99Z"/><path class="hatColor2" d="M105.3 54.4h-4a1.4 1.4 0 0 1-1-2.2l.2-.4c.3-.3.6-.5 1-.6l.5-.3c.7-.3 1.5-.4 2.2-.4H105.9c.7 0 1.3 0 2 .3l.7.3c.4.2.8.5 1.2 1l.2.2a1.3 1.3 0 0 1-1 2.1h-3.7Z"/><path class="hatLine" stroke-width="4" d="M99.8 54.4v-1.9c0-.4 0-.8.2-1.2.2-.4.5-.8 1-1l.1-.2a9.4 9.4 0 0 1 8 0l.2.1c.4.3.7.7.9 1.1l.2 1.2v2M85 58.6l-1.1.6a39.2 39.2 0 0 0-20.4 26.2c-1.5 6.3-1.8 12.8-3 19l-.4 2.2-3.8 6.9c-.8 1.5 1 3 2.2 2l8.1-6.4 2.5-1.7c4.5-2.5 9.2-4.6 14-6.3l.8-.2.4-.1a85.7 85.7 0 0 1 41.9 0h.3l.8.3a89.5 89.5 0 0 1 16.4 8l8 6.4c1.3 1 3-.5 2.2-2l-3.8-7-.3-2.5c-1.2-6-1.4-12.2-2.8-18.2a39.3 39.3 0 0 0-20.5-26.7l-1-.5c-5.7-2.9-12-4.4-18.3-4.4h-3.8c-6.4 0-12.7 1.5-18.4 4.4Z"/><path class="hatColor1 hatLine" stroke-width="2.5" d="m109.7 71.2-.2.2v-.7c-.2-5.4-8.4-5.4-8.5 0v.7l-.3-.3-.3-.2c-4-3.7-9.7 2-6 6l.3.2a16.3 16.3 0 0 0 10.5 4.5s6 0 10.5-4.5l.3-.3c3.7-3.9-2-9.6-6-6 0 .2-.2.3-.3.4Z"/><path class="hatLine" stroke-width="3" d="M60.9 106.5s13.6-17.7 45-17.7c31.3 0 43.6 17.7 43.6 17.7"/><path class="hatLine" stroke-opacity=".1" stroke-width="4" d="M58.6 115.6s17.5-14 46.7-14c29.3 0 45 14 45 14"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.HAT,
|
||||
_getHeadwearColor(hatColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getHatStyle(HatColors hatColor) internal pure returns (string memory) {
|
||||
@@ -51,4 +58,22 @@ library HeadwearHat {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(HatColors hatColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (hatColor == HatColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (hatColor == HatColors.LIGHT) {
|
||||
return Headwear.HeadwearColors.LIGHT;
|
||||
} else if (hatColor == HatColors.DARK) {
|
||||
return Headwear.HeadwearColors.DARK;
|
||||
} else if (hatColor == HatColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (hatColor == HatColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (hatColor == HatColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearIcecream {
|
||||
enum IcecreamColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearIcecream {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getIcecream(IcecreamColors iceCreamColor) external pure returns (string memory) {
|
||||
return
|
||||
function getIcecream(
|
||||
IcecreamColors iceCreamColor
|
||||
) external pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none"><style>.iceColor {fill:',
|
||||
_getIcecreamColor(iceCreamColor),
|
||||
'}</style><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M98 66.5s4.2-.5 7-.5c2.6 0 6.8.5 6.8.5"/><path fill="#735C4C" d="M91.2 19.6c7.1 1.9 13 8.6 14.2 16-4-4.9-10-8.9-16-11 0-2.4.7-3.8 1.8-5Z"/><path fill="#fff" d="M146.8 91.9c13.3-6 30.5-4.6 42.4 3.9a43 43 0 0 1 17 26.7c-.5-2-1.2-4.1-2.2-6a20.3 20.3 0 0 0-13.3-10.6c-6.6-1.4-13.3 1-19.3 4-6.1 2.8-12.2 6.2-18.9 6.6-8.1.6-16-3.2-23.4-6.7-7.4-3.5-16-5.1-24.1-5.1h-1.6a57 57 0 0 0-22.5 5c-7.5 3.5-15.3 7.4-23.4 6.8-6.7-.4-12.8-3.8-18.9-6.7-6-2.8-12.7-5.3-19.3-4A20.3 20.3 0 0 0 6 116.6c-1 1.9-1.7 3.9-2.2 6a43 43 0 0 1 17-26.7A44.1 44.1 0 0 1 63.3 92 32.9 32.9 0 0 1 80 71.8l2 .7a5 5 0 0 1 3.6-.8c2.5.4 4.5 2.3 7 2.5 2.1.2 4.1-.9 6-1.8 1.7-.8 4-1.1 5.8-1.2h.8c2 0 4.2.3 6.1 1.2 2 1 4 2 6 1.8 2.6-.2 4.6-2 7.1-2.4a6 6 0 0 1 4.9 1.6l.7-1.6a31.3 31.3 0 0 1 16.8 20Z"/><path class="iceColor" d="M104.4 71.2a15 15 0 0 0-5.7 1.2c-2 1-4 2-6 1.8-2.6-.2-4.6-2.1-7.1-2.5-1.3-.1-2.5.1-3.7.8l-2-.7 1.2-.5a26.1 26.1 0 0 1 2-24.4A26.7 26.7 0 0 1 105 35.6 27 27 0 0 1 127 47a26.1 26.1 0 0 1 2 24.3l1 .5-.7 1.6a6 6 0 0 0-4.9-1.6c-2.5.3-4.5 2.2-7 2.4-2.1.2-4.1-.9-6-1.8-2-1-4.2-1.1-6.2-1.1h-.8Z"/><circle cx="2.5" cy="2.5" r="2.5" fill="#fff" fill-opacity=".5" transform="matrix(-1 0 0 1 126.2 59)"/><path fill="#fff" fill-opacity=".5" d="M123.8 53.6a3.1 3.1 0 0 1-5.7 2.6V56a14.8 14.8 0 0 0-1-1.7c-.6-1-1.5-2.2-2.3-2.9-1-.7-1.7-1.2-2.4-1.5l-1-.6c-1-.5-1.4-1.6-1-2.5l.2-.2c.4-1 0-2-1-2.2-1.2-.2-2.2-.2-3.2-.1a1.1 1.1 0 0 1-.3-2.3 15 15 0 0 1 10.6 3l2.1 1.6a18.6 18.6 0 0 1 4.9 6.7v.2"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M63.3 92A32.9 32.9 0 0 1 80 71.9l1-.5M61.9 99.8a33 33 0 0 1 1.4-7.7M3.8 122.5c.5-2.1 1.2-4.1 2.2-6 2.7-5.2 7.6-9.4 13.3-10.6 6.6-1.4 13.3 1 19.3 4 6.1 2.8 12.2 6.2 18.9 6.6 8.1.6 16-3.3 23.4-6.7a57 57 0 0 1 24-5.1M3.8 122.6v-.1"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M63.3 92h0a44.5 44.5 0 0 0-42.5 3.8 43 43 0 0 0-17 26.7"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.2" d="M79.5 72.4c2.5-1.3 4.8-.8 6.1-.7 2.5.4 4.5 2.3 7 2.5 2.1.2 4.1-.9 6-1.8 1.7-.8 4-1.1 5.8-1.2h.8"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M105 35.6c-8.5 0-17.3 4.2-22 11.3a26.1 26.1 0 0 0-2 24.4"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.2" d="M105.4 35.6c-1.2-7.4-7-14.1-14.2-16a7.2 7.2 0 0 0-1.9 5c6.1 2.1 12 6.1 16.1 11Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M148.1 99.8a37 37 0 0 0-1.3-8 31.3 31.3 0 0 0-16.8-20l-1-.5m77.2 51.2c-.5-2-1.2-4.1-2.2-6a20.3 20.3 0 0 0-13.3-10.6c-6.6-1.4-13.3 1-19.3 4-6.1 2.8-12.2 6.2-18.9 6.6-8.1.6-16-3.2-23.4-6.7-7.4-3.5-16-5.1-24.1-5.1m101.2 17.9s0 0 0 0"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M146.8 91.9c13.3-6 30.5-4.6 42.4 3.9a43 43 0 0 1 17 26.7"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3.2" d="M132 73.1a11.1 11.1 0 0 0-7.6-1.3c-2.5.3-4.5 2.2-7 2.4-2.1.2-4.1-.9-6-1.8-2-1-4.2-1.1-6.2-1.1"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M105 35.6A27 27 0 0 1 127 47a26.1 26.1 0 0 1 2 24.3"/><path class="iceColor" stroke="#000" stroke-linecap="round" stroke-width="3.2" d="M74.6 77.8a3.1 3.1 0 0 0-5 3.8l2.8 3.6a3.1 3.1 0 0 0 4.9-3.8l-2.7-3.6Zm63.4.4a3.1 3.1 0 1 0-5.4-3.1l-2.2 3.9a3.1 3.1 0 1 0 5.3 3l2.3-3.8Zm-53.3 22.6a3.1 3.1 0 1 0-3 5.4l4 2.2a3.1 3.1 0 1 0 3-5.4l-4-2.2Zm20.5-13a3.1 3.1 0 0 0 2-5.9l-4.4-1.4a3.1 3.1 0 1 0-1.9 6l4.3 1.3Zm-68 4.6a3.1 3.1 0 0 0-2-5.9L30.8 88a3.1 3.1 0 1 0 2 5.8l4.3-1.4Zm126.8-1a3.1 3.1 0 1 0 4.2 4.6l3.3-3a3.1 3.1 0 0 0-4.1-4.6l-3.4 3ZM50.6 100a3.1 3.1 0 1 0-3 5.3l3.9 2.2a3.1 3.1 0 0 0 3-5.4l-4-2.2Zm85-1.5a3.1 3.1 0 1 1-5.8 2.4l-1.7-4.1a3.1 3.1 0 0 1 5.7-2.4l1.8 4.1Z"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.ICECREAM,
|
||||
_getHeadwearColor(iceCreamColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getIcecreamColor(IcecreamColors icecreamColor) internal pure returns (string memory) {
|
||||
@@ -31,4 +38,18 @@ library HeadwearIcecream {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(IcecreamColors icecreamColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (icecreamColor == IcecreamColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (icecreamColor == IcecreamColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (icecreamColor == IcecreamColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (icecreamColor == IcecreamColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearLeafs {
|
||||
enum LeafsColors {
|
||||
GREEN,
|
||||
@@ -11,14 +13,19 @@ library HeadwearLeafs {
|
||||
|
||||
// // we take the 15th byte from the left for hat color
|
||||
// uint8 color = uint8((seed >> 136) & 0xFF) % 3;
|
||||
function getLeafs(LeafsColors leafsColor) internal pure returns (string memory) {
|
||||
function getLeafs(
|
||||
LeafsColors leafsColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
// leafs (4 colors: green, purple, blue, gold)
|
||||
return
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getLeafsStyle(leafsColor),
|
||||
'<g clip-path="url(#a)"><path class="hwcolor" d="m40.4 87.2 1.7 3.3s3.3.3 5.4.7c2.3.5 5.8 1.9 5.8 1.9h.7l-2.1-4.6-4.5-3.9-6.8-.1-.2 2.7Z"/><path class="hwline35" d="M40.5 92c-1-2.8-1.4-5.8-1.1-8.8a19.2 19.2 0 0 1 18 14"/><path class="line25" d="m45.4 89.2 3.5 4"/><path class="hwcolor" d="M66.9 102.4s0-8.5 2.2-14c.1-.3.6-.7.6-.7l-.6-3.8-2.4-2.6-4.5-2.8-7.9-3.3L53 85.4s1.2 7.8 5 9.8l8.9 7.2Z"/><path class="hwline35" d="M57.6 97.2a28.7 28.7 0 0 1-3.6-23c3 2.3 6.8 3.5 10.2 5.4 3.4 1.9 6.5 4.8 6.8 8.4"/><path class="hwline3" d="M60 86.7c1.5 5.2 4.5 10 8.4 13.6"/><path class="hwcolor" d="M84.6 193.7c5.3 1 13.6 2 13.6 2l1.4 1-1.4 4.3-6 7.9-6.5 3.6-8.6 2.5-4-5.6-3.3-7.4-.3-8.8 2.3-2.6s7.8 2 12.8 3Z"/><path class="hwcolor" d="m69.7 189.9-4.6-1.5-1.8-.7-5 4.3-2.7 7.4 1 6h14l-1.8-5.5.9-10Z"/><path class="hwline35" d="M70.9 188.8c-3 3.8-2.6 9.3-.8 13.8 1.7 4.5 4.7 8.5 6.5 13A44.7 44.7 0 0 0 92 209a19 19 0 0 0 8.2-14"/><path class="hwline3" d="M85 192.4a71.4 71.4 0 0 1-4.7 13"/><path class="hwcolor" d="m41 185.9 9.9-3.2 4.7 2c2 .9 5.1 2 5.1 2l-2.7 5.4h-2l-7.2-.3-8-6Z"/><path class="hwline35" d="M70.6 206.1c-4.4 0-8.8-.2-13.3-.4a15.8 15.8 0 0 1 0-11c1.3-3.4 4-6.4 7.2-8.2"/><path class="hwline3" d="M68 194a21.8 21.8 0 0 0-5 4.4"/><path class="hwline35" d="M57.5 193.1c-7.2.7-14.6-2.6-18.5-8.3 3.9-.2 7.7-1.5 10.9-3.7"/><path class="line25" d="M52 186.6c2.3.2 4.7-.2 6.8-1.1"/></g><g clip-path="url(#b)"><path class="hwcolor" d="m169.4 87.2-1.7 3.3s-3.3.3-5.4.7c-2.3.5-5.7 1.9-5.7 1.9h-.7l2-4.6 4.6-3.9 6.8-.1.1 2.7Z"/><path class="hwline35" d="M169.3 92c1-2.8 1.4-5.8 1.2-8.8a19.2 19.2 0 0 0-18 14"/><path class="line25" d="m164.5 89.2-3.6 4"/><path class="hwcolor" d="M143 102.4s0-8.5-2.2-14l-.6-.7.6-3.8 2.4-2.6 4.4-2.8 8-3.3 1.3 10.2s-1.2 7.8-5 9.8c-.6.3-9 7.2-9 7.2Z"/><path class="hwline35" d="M152.2 97.2a28.7 28.7 0 0 0 3.7-23c-3 2.3-6.9 3.5-10.2 5.4-3.4 1.9-6.6 4.8-6.8 8.4"/><path class="hwline3" d="M149.8 86.7a29.5 29.5 0 0 1-8.4 13.6"/><path class="hwcolor" d="M125.2 193.7c-5.2 1-13.6 2-13.6 2l-1.4 1 1.4 4.3 6 7.9 6.5 3.6 8.7 2.5 4-5.6 3.2-7.4.3-8.8-2.3-2.6s-7.7 2-12.8 3Z"/><path class="hwcolor" d="m140.2 190 4.5-1.6 1.8-.7 5 4.3 2.8 7.4-1 6h-14.1l1.8-5.5-.8-9.8Z"/><path class="hwline35" d="M139 188.8c3 3.8 2.6 9.3.8 13.8s-4.7 8.5-6.6 13a44.7 44.7 0 0 1-15.4-6.5 19 19 0 0 1-8.2-14"/><path class="hwline3" d="M124.8 192.4c1.2 4.4 2.8 8.8 4.8 13"/><path class="hwcolor" d="m168.9 185.9-9.9-3.2-4.7 2c-2 1-5.1 2.1-5.1 2.1l2.7 5.3h1.8l7.2-.3 8-6Z"/><path class="hwline35" d="M139.3 206.1c4.4 0 8.8-.2 13.2-.4a15.8 15.8 0 0 0-7.2-19.2"/><path class="hwline3" d="M142 194c1.8 1.3 3.5 2.7 4.9 4.4"/><path class="hwline35" d="M152.4 193.1c7.2.7 14.6-2.6 18.5-8.3-4-.2-7.7-1.5-11-3.7"/><path class="line25" d="M157.8 186.6c-2.3.2-4.6-.2-6.8-1.1"/></g></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.LEAFS,
|
||||
_getHeadwearColor(leafsColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getLeafsStyle(LeafsColors leafsColor) internal pure returns (string memory) {
|
||||
@@ -43,4 +50,18 @@ library HeadwearLeafs {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(LeafsColors leafsColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (leafsColor == LeafsColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (leafsColor == LeafsColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (leafsColor == LeafsColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (leafsColor == LeafsColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearNightcap {
|
||||
enum NightcapColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearNightcap {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getNightcap(NightcapColors nightcapColor) internal pure returns (string memory) {
|
||||
return
|
||||
function getNightcap(
|
||||
NightcapColors nightcapColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getNightcapStyle(nightcapColor),
|
||||
'<path class="nightcapColor1" d="M160.4 111c-3-.2-6.1.8-8.6 2.6a94.6 94.6 0 0 0-11.1-19.8 75.2 75.2 0 0 1-72-.5c0-9 .3-19 4.6-27A40.6 40.6 0 0 1 99.9 48a48.4 48.4 0 0 1 35 3.7 47.5 47.5 0 0 1 20.5 26 122 122 0 0 1 5.2 33.4h-.2Z"/><path fill="#fff" d="M160.6 111c5.6.3 10.9 4.4 12.3 9.7 1.5 5.3-.9 11.4-5.6 14.5-4.8 3-11.5 2.7-16-.8a13.3 13.3 0 0 1-4.1-15 13.9 13.9 0 0 1 13.3-8.5Zm-92-17.7a75.2 75.2 0 0 0 72 .5c2.4 3.3 4.6 6.7 6.6 10.3a95 95 0 0 1-41.8 10.6c-14 .1-28-3.2-40-10-1.1-4-.4-8.2 2.3-11.9l1 .5Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M147.2 104s0 0 0 0a95 95 0 0 1-41.8 10.7c-14 .1-28-3.2-40-10-1.1-4-.4-8.2 2.3-11.9l1 .5a75.2 75.2 0 0 0 72 .5"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M131.3 82.7a104.3 104.3 0 0 1 20.5 31"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M68.6 93.4v0c.2-9 .4-19 4.7-27a40.6 40.6 0 0 1 26.6-18.5 48.4 48.4 0 0 1 35 3.7 47.5 47.5 0 0 1 20.5 26 122 122 0 0 1 5.2 33.4c5.6.3 10.9 4.4 12.3 9.7 1.5 5.3-.9 11.4-5.6 14.5-4.8 3-11.5 2.7-16-.8a13.3 13.3 0 0 1-4.1-15 13.9 13.9 0 0 1 13.3-8.5"/><path fill="#fff" d="M90 59.2a4 4 0 1 1 0 8 4 4 0 0 1 0-8Z"/><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M86 63.2a4 4 0 1 1 8.1 0 4 4 0 0 1-8 0Z"/><path fill="#fff" d="M73 82.7a3.4 3.4 0 1 1 0 6.8 3.4 3.4 0 0 1 0-6.8Z"/><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M69.6 86a3.4 3.4 0 1 1 6.8 0 3.4 3.4 0 0 1-6.8 0Z"/><path fill="#fff" d="M146.3 81a2.4 2.4 0 1 1 0 4.7 2.4 2.4 0 0 1 0-4.8Z"/><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M144 83.3a2.4 2.4 0 1 1 4.7 0 2.4 2.4 0 0 1-4.8 0Z"/><path fill="#fff" d="M105.7 47.4c1.7-.2 3.3.8 3.5 2.4.2 1.5-1 3-2.8 3.2-1.8.2-3.4-.9-3.5-2.4-.2-1.6 1-3 2.8-3.2Z"/><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M102.9 50.6c-.2-1.6 1-3 2.8-3.2 1.7-.2 3.3.8 3.5 2.4.2 1.5-1 3-2.8 3.2-1.8.2-3.4-.9-3.5-2.4Z"/><path fill="#fff" stroke="#000" stroke-linecap="round" stroke-width="3" d="M113.7 58.3c.9-.3 1.5.9 1 1.7a8.4 8.4 0 0 0-.3 7 8.3 8.3 0 0 0 11.5 4.2c.9-.4 2 .2 1.7 1a11 11 0 1 1-14-14ZM90.6 86h0Zm0 0h0m0 0h0m0 0h0Zm10.2-2h0a6.6 6.6 0 0 1-4.3-3.8c-.6-1.4-2.7-1.4-3 .2h0a6 6 0 0 1-3.4 4.2h0c-1.4.6-1.2 2.5.1 2.9h0c1.9.5 3.5 1.9 4.3 3.8h0a1.6 1.6 0 0 0 3-.2h0a6 6 0 0 1 3.3-4.2h0l.2-.1a1.5 1.5 0 0 0-.2-2.9ZM136 58.3h0c-.7-.2-1.4-.6-1.8-1.4-.6-1.3-2.7-1.1-3 .4h0a2 2 0 0 1-1 1.8h0c-1.2.7-1 2.5.4 2.8h0c.6.1 1.3.6 1.7 1.4h0c.7 1.4 2.7 1 3-.5 0 0 0 0 0 0h0a2 2 0 0 1 1-1.7h0c1.3-.7 1-2.5-.3-2.8Zm-9.2 36.2h0c-1-.6-1.8-1.7-2-3.2-.3-1.4-2.3-1.9-3-.5h0c-.7 1.3-1.7 2-2.7 2.3h-.1l.3 1.4-.3-1.4c-1.4.2-1.7 2-.5 2.8h0c1 .6 1.8 1.7 2 3.2h0a1.6 1.6 0 0 0 3 .4h0a4 4 0 0 1 2.6-2.2h.2c1.4-.3 1.7-2 .5-2.8Z"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.NIGHTCAP,
|
||||
_getHeadwearColor(nightcapColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getNightcapStyle(NightcapColors nightcapColor) internal pure returns (string memory) {
|
||||
@@ -43,4 +50,18 @@ library HeadwearNightcap {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(NightcapColors nightcapColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (nightcapColor == NightcapColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (nightcapColor == NightcapColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (nightcapColor == NightcapColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (nightcapColor == NightcapColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearPartyhat {
|
||||
enum PartyhatColors {
|
||||
GREEN,
|
||||
@@ -9,13 +11,18 @@ library HeadwearPartyhat {
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getPartyhat(PartyhatColors partyhatColor) internal pure returns (string memory) {
|
||||
return
|
||||
function getPartyhat(
|
||||
PartyhatColors partyhatColor
|
||||
) internal pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getPartyhatStyle(partyhatColor),
|
||||
'<path class="partyhatColor2" d="M99 34.9a12 12 0 0 0 10.7.8l2.2.6 9.5 16.9a50 50 0 0 1-24.8-14c.5-1 1-2 1.7-3L99 35Z"/><path fill="#fff" d="M99 34.9a11.5 11.5 0 0 1-4.7-12.3c1.2-4.5 5.5-8 10.2-8.3 4.7-.3 9.4 2.8 11 7.2 1.7 4.4.3 9.7-3.3 12.7-.8.6-1.6 1-2.5 1.5a11.5 11.5 0 0 1-10.7-.8Z"/><path class="partyhatColor1" d="M141.3 90.5a108.7 108.7 0 0 1-56-31l11.3-20.2c6.3 7 15.6 11.6 24.8 13.9 6.7 12.2 13.4 24.6 20 37.3Z"/><path class="partyhatColor2" d="M72.4 83.3c4.3-8 8.5-16 12.9-23.8a108.7 108.7 0 0 0 56 31l6.3 12.2a57.5 57.5 0 0 1-21.3 10.2 95 95 0 0 1-53.9-29.6Z"/><path class="partyhatColor1" d="m62.4 102.7 10-19.4a95 95 0 0 0 54 29.6 93.5 93.5 0 0 1-21.3 1.9c-20.2 0-29.7-3-42.7-12.1Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="m98.3 36.3-1.7 3a1648.8 1648.8 0 0 0-34.2 63.4c13 9.2 22.5 12.1 42.7 12.1m36.2-24.3 6.3 12.2a57.5 57.5 0 0 1-21.3 10.2 93.5 93.5 0 0 1-21.2 1.9m6.9-78.5a1948.7 1948.7 0 0 1 29.3 54.2m-31.6-54.8c.9-.4 1.7-1 2.5-1.5 3.6-3 5-8.4 3.4-12.7a11.5 11.5 0 0 0-11.1-7.2c-4.7.3-9 3.8-10.2 8.3C93 27.3 95 32.5 99 35a12 12 0 0 0 10.7.8Z"/><path stroke="#000" stroke-linecap="round" stroke-linejoin="round" stroke-width="4" d="M96.6 39.3c6.3 7 15.6 11.6 24.8 13.9m-36.1 6.3a108.7 108.7 0 0 0 56 31h0m-68.9-7.2a95 95 0 0 0 54 29.6h0"/><path fill="#fff" d="M35.1 89.7c5.2-1 9.6-5.5 10.7-10.7C48 84 52 88.5 57 90.3a16.6 16.6 0 0 0-11.3 12.3c-.8-5.8-5-11-10.6-12.9Z"/><path class="partyhatSparkles" d="M45.8 79c-1 5.2-5.5 9.6-10.7 10.7 5.5 2 9.8 7.1 10.6 13A16.6 16.6 0 0 1 57 90.2c-5-1.8-9-6.2-11.2-11.3Z"/><path fill="#fff" d="M151.6 50.2a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"/><path class="partyhatSparkles" d="M151.6 50.2a4 4 0 1 0 0-8 4 4 0 0 0 0 8Z"/><path fill="#fff" d="M55.7 55.6a6.7 6.7 0 1 0 0-13.4 6.7 6.7 0 0 0 0 13.4Z"/><path class="partyhatSparkles" d="M55.7 55.6a6.7 6.7 0 1 0 0-13.4 6.7 6.7 0 0 0 0 13.4Z"/><path fill="#fff" d="M172.9 71.2c-.2-4.7-4.1-9-8.8-9.7 4.3-.3 8.2-4 8.6-8.3a11 11 0 0 0 8.6 8.3 10 10 0 0 0-8.4 9.7Z"/><path class="partyhatSparkles" d="M172.7 53.2c-.4 4.3-4.3 8-8.6 8.3 4.7.7 8.6 5 8.8 9.7 0-4.7 3.8-9 8.4-9.7a11 11 0 0 1-8.6-8.3Z"/><path fill="#fff" d="M17.8 69.2a4.4 4.4 0 1 1 8.7 0 4.4 4.4 0 0 1-8.7 0Z"/><path class="partyhatSparkles" d="M17.783 70.18a4.374 4.374 0 0 1 4.37-4.37c2.41 0 4.38 1.96 4.38 4.38a4.37 4.37 0 0 1-4.38 4.37c-2.42 0-4.37-1.96-4.37-4.37v-.01Z"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.PARTYHAT,
|
||||
_getHeadwearColor(partyhatColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getPartyhatStyle(PartyhatColors partyhatColor) internal pure returns (string memory) {
|
||||
@@ -45,4 +52,18 @@ library HeadwearPartyhat {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(PartyhatColors partyhatColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (partyhatColor == PartyhatColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (partyhatColor == PartyhatColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (partyhatColor == PartyhatColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (partyhatColor == PartyhatColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearPlants {
|
||||
enum PlantsColors {
|
||||
GREEN,
|
||||
@@ -11,14 +13,19 @@ library HeadwearPlants {
|
||||
|
||||
// // we take the 16th byte from the left for plants color
|
||||
// uint8 color = uint8((seed >> 128) & 0xFF) % 3;
|
||||
function getPlants(PlantsColors plantsColor) external pure returns (string memory) {
|
||||
function getPlants(
|
||||
PlantsColors plantsColor
|
||||
) external pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
// plants (4 colors: green, purple, blue, gold)
|
||||
return
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none">',
|
||||
_getPlantsStyle(plantsColor),
|
||||
'<path class="color1" d="m64.3 81 10.3-1.4-3.4 8.8L69 96v6l-1.4 2.6-6.7 2.1-9-1.3-6.6-3.5 2-4.5 6-8.9 11-7.5Z"/><path class="color2" d="M56.8 106h7.6l-1 2.1-2 2-3.1 1.5-4 1.7h-5.8l-4.5-1.1-3.9-3.2-2.2-5 .6-2.8 1.6-1.2 4 1.2 5.5 2.2 7.2 2.5Z"/><path class="color1" d="m96.3 59.3 2.5 7.3 6.2-1.2v-12l-2.3-5-4.6-4.3-4.8-4.6-7.1-3.7-8.2-1.5h-7l-7.4 2.4-8 6L51 50v1.9h5.3l3.6-1 2.6-4 3.5-2 5-1.5 7 .8 7.2 2.8 6.3 4.9 4.7 7.5Z"/><path class="color2" d="m71.8 64 3.6 6.3-3.6 2.9-3.7 1-5.3-1.7v-2.2l-.3-5.7v-11l5.2 3.6 4 6.9Zm-29.4 6-3.6 6.2 3.6 2.8 3.6 1 9.7-3.8-2-2.5-2-3.2-1.6-7.6L48 54l-5.6 4v12Z"/><path class="color2" d="m50.1 63.4-1.5-8.2 3.6-2.9 3.7-1 4.8 3.2 2.7 3.2-.7 4V70l-2 7.5-7.5-4.6-3.1-9.5Zm-9.3 10 1.4-7.3v-3.9l-.7-5.2-5.1 8v5.7l.5 1.5 3.9 1.2Z"/><path class="hwline4" d="M98.3 66.6c-1-6.1-3.7-12-8-16.4A23.7 23.7 0 0 0 73.5 43c-6.2 0-10.4 3-13.9 8.2"/><path class="hwline4" d="M104.8 53.1c-3.6-7-9.4-13-16.6-16.3a29.5 29.5 0 0 0-23-.8c-7.4 3-13.3 9.5-15 17.2"/><path class="hwline4" d="M57.4 52c-2.6-1.3-6 .4-7.3 3-1.3 2.6-1 5.8-.3 8.6a28.3 28.3 0 0 0 8.7 14l1 .5c.6 0 1-.7 1.3-1.3 4-8.2 4.1-21-3.4-24.8h0ZM38 77.2a15.1 15.1 0 0 0 17-1.8"/><path class="hwline4" d="M58.8 52.6c2.9-.7 5.9 1 7.8 3.3 1.8 2.3 2.8 5.1 4 7.8 1.2 2.8 2.7 5.5 5.1 7.2-3 3.4-8.4 4.4-12.4 2.3M49.2 53.6c-2.5-.3-5.1 1-6.9 2.9-1.8 1.9-3 4.3-4 6.6-1 2.4-2 4.9-3.7 6.9a9.7 9.7 0 0 0 4 4.3m6.6 26.5c3.3-5.5 6.7-11 11.5-15.1 4.8-4.2 12-6.5 18.3-5.6 0 0-4.3 6.5-5.8 14.2-.8 4.1-.8 10.3-.8 10.3"/><path class="hwline4" d="M68.4 104.6a23.7 23.7 0 0 1-14.2 1c-3.8-1.3-7.4-3.3-11-5-1.5-.8-3.4-1.4-4.8-.4-1 .9-1.1 2.5-.9 3.8a12 12 0 0 0 7.6 8.6c3.7 1.5 8 1.2 11.7-.2 3.7-1.4 9.3-4.7 11.6-7.8Z"/><path class="hwline3" d="M74.4 80A35.2 35.2 0 0 0 58 97.4m-8-43.1c-3-.6-6 2-7.2 5-1.2 2.9-1 6.2-1.3 9.3-.3 3.2-1 6.6-3.6 8.6"/><path class="color1" d="m145.5 81-10.4-1.4 3.5 8.8 2.2 7.5v6l1.5 2.6 6.7 2.1 9-1.3 6.5-3.5-2-4.5-6-8.9-11-7.5Z"/><path class="color2" d="M153 106h-7.6l1 2.1 2 2 3.1 1.5 4 1.7h5.8l4.4-1.1 4-3.2 2.1-5-.6-2.8-1.6-1.2-3.9 1.2-5.5 2.2-7.3 2.5Z"/><path class="color1" d="m113.5 59.3-2.5 7.3-6.2-1.2v-12l2.3-5 4.6-4.3 4.7-4.6 7.2-3.7 8.1-1.5h7l7.5 2.4 8 6 4.5 7.2v1.9h-5.3l-3.7-1-2.6-4-3.4-2-5-1.5-7 .8-7.2 2.8-6.3 4.9-4.7 7.5Z"/><path class="color2" d="m138 64-3.6 6.3 3.6 2.9 3.6 1 5.4-1.7v-2.2l.3-5.7v-11l-5.2 3.6-4 6.9Zm29.4 6 3.6 6.2-3.6 2.8-3.7 1-9.7-3.8 2.2-2.5 2-3.2 1.5-7.6 2.1-8.8 5.6 4V70Z"/><path class="color2" d="m159.7 63.4 1.5-8.2-3.7-2.9-3.6-1-4.8 3.2-2.7 3.2.7 4V70l2 7.5 7.5-4.6 3-9.5Zm9.3 10-1.4-7.3v-3.9l.7-5.2 5.1 8v5.7l-.6 1.5-3.8 1.2Z"/><path class="hwline4" d="M111.5 66.4c1-6.1 3.7-11.8 8-16.2a23.7 23.7 0 0 1 16.7-7.1c6.2 0 10.4 3 13.9 8.2"/><path class="hwline4" d="M103.3 56.5c4-9.3 11.1-16.4 18.3-19.7a29.5 29.5 0 0 1 23-.8c7.4 3 13.3 9.5 15 17.2"/><path class="hwline4" d="M152.4 52c2.6-1.3 6 .4 7.3 3 1.3 2.6 1 5.8.3 8.6a28.3 28.3 0 0 1-8.8 14c-.2.2-.5.4-.9.5-.6 0-1-.7-1.4-1.3-3.8-8.2-4-21 3.5-24.8h0Zm19.5 25.2a15.1 15.1 0 0 1-17.3-1.8"/><path class="hwline4" d="M151 52.6c-2.9-.7-6 1-7.8 3.3-1.8 2.3-2.9 5.1-4 7.8A15.6 15.6 0 0 1 134 71c3 3.4 8.3 4.4 12.4 2.3m14.2-19.7c2.5-.3 5.1 1 6.9 2.9 1.8 1.9 2.9 4.3 4 6.6 1 2.4 2 4.9 3.7 6.9a9.7 9.7 0 0 1-4 4.3m-6.6 26.5c-3.3-5.5-6.7-11-11.5-15.1-4.8-4.2-12-6.5-18.3-5.6 0 0 4.2 6.5 5.8 14.2.8 4.1.8 10.3.8 10.3"/><path class="hwline4" d="M141.4 104.6a23.7 23.7 0 0 0 14.2 1c3.8-1.3 7.3-3.3 11-5 1.5-.8 3.4-1.4 4.7-.4 1 .9 1.2 2.5 1 3.8a12 12 0 0 1-7.6 8.6c-3.7 1.5-8 1.2-11.7-.2a29.3 29.3 0 0 1-11.6-7.8Z"/><path class="hwline3" d="M135.4 80a35.2 35.2 0 0 1 16.4 17.4m7.9-43.1c3.2-.6 6.1 2 7.3 5 1.1 2.9 1 6.2 1.3 9.3.2 3.2 1 6.6 3.6 8.6"/><path fill="#000" fill-opacity=".1" d="m111.5 66 1.9-8s-4.8 3.1-8.4 3.1c-3.6 0-8.4-3-8.4-3l1.5 8h13.4Z"/><path class="hwline4" d="M98 66.5s4.2-.5 7-.5c2.6 0 6.8.5 6.8.5"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.PLANTS,
|
||||
_getHeadwearColor(plantsColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getPlantsStyle(PlantsColors plantsColor) internal pure returns (string memory) {
|
||||
@@ -47,4 +54,18 @@ library HeadwearPlants {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(PlantsColors plantsColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (plantsColor == PlantsColors.GREEN) {
|
||||
return Headwear.HeadwearColors.GREEN;
|
||||
} else if (plantsColor == PlantsColors.PURPLE) {
|
||||
return Headwear.HeadwearColors.PURPLE;
|
||||
} else if (plantsColor == PlantsColors.BLUE) {
|
||||
return Headwear.HeadwearColors.BLUE;
|
||||
} else if (plantsColor == PlantsColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,27 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.0;
|
||||
|
||||
import {Headwear} from 'contracts/libraries/svgs/Profile/Headwear.sol';
|
||||
|
||||
library HeadwearSparkles {
|
||||
enum SparklesColors {
|
||||
WHITE,
|
||||
LIGHT,
|
||||
GOLD
|
||||
}
|
||||
|
||||
function getSparkles(SparklesColors sparklesColor) external pure returns (string memory) {
|
||||
function getSparkles(
|
||||
SparklesColors sparklesColor
|
||||
) external pure returns (string memory, Headwear.HeadwearVariants, Headwear.HeadwearColors) {
|
||||
// sparkle (2 colors: white, gold)
|
||||
return
|
||||
return (
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="197" viewBox="0 0 210 197" fill="none">',
|
||||
_getSparklesStyle(sparklesColor),
|
||||
'<path class="hwcolor" d="M155.643 53.12c.107-.297.54-.286.642.012 1.901 5.575 6.049 9.99 11.277 11.917a.085.085 0 0 1-.002.16l-.545.198c-4.979 1.803-8.864 5.945-10.599 11.297l-.026.08a.254.254 0 0 1-.483.003c-1.886-5.683-6.035-10.183-11.315-12.137a.096.096 0 0 1 .004-.18l.241-.08c5.035-1.735 9.015-5.876 10.806-11.27ZM69.698 37.675c.063-.176.32-.17.381.008 1.13 3.312 3.594 5.936 6.7 7.08a.05.05 0 0 1-.001.095l-.324.118c-2.958 1.071-5.266 3.532-6.297 6.712l-.015.048a.151.151 0 0 1-.287.001c-1.121-3.376-3.586-6.05-6.724-7.21a.057.057 0 0 1 .003-.108l.143-.048c2.992-1.03 5.356-3.49 6.42-6.696ZM21.911 52.734c.063-.176.32-.17.381.008 1.13 3.312 3.594 5.936 6.7 7.08a.05.05 0 0 1 0 .095l-.324.118c-2.959 1.071-5.267 3.532-6.297 6.712l-.016.048a.151.151 0 0 1-.287.001c-1.12-3.376-3.586-6.05-6.723-7.21a.057.057 0 0 1 .002-.108l.144-.048c2.991-1.03 5.356-3.49 6.42-6.696Zm160.991-12.4c.063-.176.321-.17.381.008 1.13 3.312 3.594 5.936 6.7 7.08.043.018.043.079-.001.095l-.324.118c-2.958 1.07-5.266 3.532-6.297 6.712l-.015.048a.151.151 0 0 1-.287.001c-1.121-3.376-3.586-6.05-6.723-7.21a.057.057 0 0 1 .002-.108l.143-.048c2.992-1.03 5.356-3.49 6.421-6.696Z"/><path class="hwcolor" d="M135.213 29.984c.045-.126.229-.121.272.005.805 2.36 2.561 4.23 4.775 5.046a.036.036 0 0 1-.001.068l-.23.084c-2.108.763-3.754 2.517-4.488 4.784l-.011.034a.108.108 0 0 1-.205 0c-.799-2.406-2.555-4.311-4.791-5.139a.04.04 0 0 1 .001-.076l.102-.034c2.133-.734 3.818-2.488 4.576-4.772Z"/><path class="hwcolor" d="M52.283 63.067c.094-.262.476-.252.566.011 1.678 4.92 5.339 8.818 9.954 10.519a.075.075 0 0 1-.002.14l-.481.175c-4.394 1.591-7.823 5.247-9.355 9.971l-.023.071a.225.225 0 0 1-.426.002c-1.665-5.016-5.327-8.987-9.988-10.712a.085.085 0 0 1 .004-.159l.213-.071c4.444-1.53 7.956-5.186 9.538-9.947Z"/></svg>'
|
||||
);
|
||||
),
|
||||
Headwear.HeadwearVariants.SPARKLES,
|
||||
_getHeadwearColor(sparklesColor)
|
||||
);
|
||||
}
|
||||
|
||||
function _getSparklesStyle(SparklesColors sparklesColor) internal pure returns (string memory) {
|
||||
@@ -27,7 +34,7 @@ library HeadwearSparkles {
|
||||
}
|
||||
|
||||
function _getSparklesColor(SparklesColors sparklesColor) internal pure returns (string memory) {
|
||||
if (sparklesColor == SparklesColors.WHITE) {
|
||||
if (sparklesColor == SparklesColors.LIGHT) {
|
||||
return '#000';
|
||||
} else if (sparklesColor == SparklesColors.GOLD) {
|
||||
return '#B96326';
|
||||
@@ -35,4 +42,14 @@ library HeadwearSparkles {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
|
||||
function _getHeadwearColor(SparklesColors sparklesColor) internal pure returns (Headwear.HeadwearColors) {
|
||||
if (sparklesColor == SparklesColors.LIGHT) {
|
||||
return Headwear.HeadwearColors.LIGHT;
|
||||
} else if (sparklesColor == SparklesColors.GOLD) {
|
||||
return Headwear.HeadwearColors.GOLD;
|
||||
} else {
|
||||
revert(); // Avoid warnings.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,91 +12,143 @@ import {Hands} from './Hands.sol';
|
||||
import {Logo} from './Logo.sol';
|
||||
|
||||
library ProfileSVG {
|
||||
function getProfileSVG(uint256 profileId) public pure returns (string memory) {
|
||||
uint256 seed = uint256(keccak256(abi.encodePacked(profileId)));
|
||||
bool isGold = profileId <= 1000;
|
||||
return _getSVG(seed, isGold);
|
||||
struct ChosenElements {
|
||||
Background.BackgroundColors backgroundColor;
|
||||
Skin.SkinColors skinColor;
|
||||
Legs.LegColors legColor;
|
||||
Shoes.ShoeColors shoeColor;
|
||||
Hands.HandsVariants handsVariant;
|
||||
Body.BodyVariants bodyVariant;
|
||||
Body.BodyColors bodyColor;
|
||||
Logo.LogoVariants logoVariant;
|
||||
Logo.LogoColors logoColor;
|
||||
Head.HeadColors headColor;
|
||||
Headwear.HeadwearVariants headwearVariant;
|
||||
Headwear.HeadwearColors headwearColor;
|
||||
Face.FaceVariants faceVariant;
|
||||
bool isGold;
|
||||
}
|
||||
|
||||
function _getSVG(uint256 seed, bool isGold) internal pure returns (string memory) {
|
||||
Background.BackgroundColors backgroundColor = isGold
|
||||
function getProfileSVG(uint256 profileId) public pure returns (string memory, string memory) {
|
||||
uint256 seed = uint256(keccak256(abi.encodePacked(profileId)));
|
||||
bool isGold = profileId <= 1000;
|
||||
(ChosenElements memory chosenElements, string memory headwearSvg) = _chooseElements(seed, isGold);
|
||||
|
||||
return (_getSVG(chosenElements, headwearSvg), _getTraits(chosenElements));
|
||||
}
|
||||
|
||||
function _getSVG(
|
||||
ChosenElements memory chosenElements,
|
||||
string memory headwearSvg
|
||||
) internal pure returns (string memory) {
|
||||
return
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="275" height="275" fill="none"><g>',
|
||||
'<path fill="url(',
|
||||
Background.getBackgroundColor(chosenElements.backgroundColor),
|
||||
')" d="M0 0h275v415H0z"/></g>',
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none" id="container" x="52" viewBox="0 0 260 415" >',
|
||||
_generateSvgElements(chosenElements, headwearSvg),
|
||||
'</svg><defs><radialGradient id="green" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#DFFFBF"/><stop offset="1" stop-color="#EFD"/></radialGradient><radialGradient id="purple" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#F1E4FF"/><stop offset="1" stop-color="#F8F1FF"/></radialGradient><radialGradient id="blue" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#E6EAFF"/><stop offset="1" stop-color="#EFF2FF"/></radialGradient><radialGradient id="yellow" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFE7A5"/><stop offset="1" stop-color="#FFF2CE"/></radialGradient></defs></svg>'
|
||||
);
|
||||
}
|
||||
|
||||
function _getTraits(ChosenElements memory chosenElements) internal pure returns (string memory) {
|
||||
return '';
|
||||
}
|
||||
|
||||
function _chooseElements(
|
||||
uint256 seed,
|
||||
bool isGold
|
||||
) internal pure returns (ChosenElements memory chosenElements, string memory headwearSvg) {
|
||||
chosenElements.backgroundColor = isGold
|
||||
? Background.BackgroundColors.GOLD
|
||||
: Background.BackgroundColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.BACKGROUND)) %
|
||||
uint8(type(Background.BackgroundColors).max)
|
||||
);
|
||||
|
||||
return
|
||||
string.concat(
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="275" height="275" fill="none"><g>',
|
||||
'<path fill="url(',
|
||||
Background.getBackgroundColor(backgroundColor),
|
||||
')" d="M0 0h275v415H0z"/></g>',
|
||||
'<svg xmlns="http://www.w3.org/2000/svg" width="210" height="335" fill="none" id="container" x="52" viewBox="0 0 260 415" >',
|
||||
_getElements(seed, isGold),
|
||||
'</svg><defs><radialGradient id="green" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#DFFFBF"/><stop offset="1" stop-color="#EFD"/></radialGradient><radialGradient id="purple" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#F1E4FF"/><stop offset="1" stop-color="#F8F1FF"/></radialGradient><radialGradient id="blue" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#E6EAFF"/><stop offset="1" stop-color="#EFF2FF"/></radialGradient><radialGradient id="yellow" cx="0" cy="0" r="1" gradientTransform="matrix(275 -275 362 362 0 275)" gradientUnits="userSpaceOnUse"><stop stop-color="#FFE7A5"/><stop offset="1" stop-color="#FFF2CE"/></radialGradient></defs></svg>'
|
||||
);
|
||||
}
|
||||
|
||||
function _getElements(uint256 seed, bool isGold) internal pure returns (string memory str) {
|
||||
Skin.SkinColors skinColor = isGold
|
||||
chosenElements.skinColor = isGold
|
||||
? Skin.SkinColors.GOLD
|
||||
: Skin.SkinColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.SKIN)) % uint8(type(Skin.SkinColors).max)
|
||||
);
|
||||
|
||||
{
|
||||
Legs.LegColors legColor = Legs.LegColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.LEGS)) % (uint8(type(Legs.LegColors).max) + 1)
|
||||
);
|
||||
chosenElements.legColor = Legs.LegColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.LEGS)) % (uint8(type(Legs.LegColors).max) + 1)
|
||||
);
|
||||
|
||||
Shoes.ShoeColors shoeColor = Shoes.ShoeColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.SHOES)) % (uint8(type(Shoes.ShoeColors).max) + 1)
|
||||
);
|
||||
chosenElements.shoeColor = Shoes.ShoeColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.SHOES)) % (uint8(type(Shoes.ShoeColors).max) + 1)
|
||||
);
|
||||
|
||||
str = string.concat(str, Legs.getLegs(legColor), Shoes.getShoes(shoeColor));
|
||||
}
|
||||
|
||||
Hands.HandsVariants handsVariant = Hands.HandsVariants(
|
||||
chosenElements.handsVariant = Hands.HandsVariants(
|
||||
uint8(Helpers.getVariant(seed, Helpers.ComponentBytes.HANDS)) % (uint8(type(Hands.HandsVariants).max) + 1)
|
||||
);
|
||||
|
||||
Body.BodyVariants bodyVariant = Body.BodyVariants(
|
||||
chosenElements.bodyVariant = Body.BodyVariants(
|
||||
uint8(Helpers.getVariant(seed, Helpers.ComponentBytes.BODY)) % (uint8(type(Body.BodyVariants).max) + 1)
|
||||
);
|
||||
|
||||
Body.BodyColors bodyColor = Body.BodyColors(
|
||||
chosenElements.bodyColor = Body.BodyColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.BODY)) % (uint8(type(Body.BodyColors).max) + 1)
|
||||
);
|
||||
|
||||
{
|
||||
Logo.LogoVariants logoVariant = Logo.LogoVariants(
|
||||
uint8(Helpers.getVariant(seed, Helpers.ComponentBytes.LOGO)) % (uint8(type(Logo.LogoVariants).max) + 1)
|
||||
);
|
||||
chosenElements.logoVariant = Logo.LogoVariants(
|
||||
uint8(Helpers.getVariant(seed, Helpers.ComponentBytes.LOGO)) % (uint8(type(Logo.LogoVariants).max) + 1)
|
||||
);
|
||||
|
||||
Logo.LogoColors logoColor = Logo.LogoColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.LOGO)) % (uint8(type(Logo.LogoColors).max) + 1)
|
||||
);
|
||||
chosenElements.logoColor = Logo.LogoColors(
|
||||
uint8(Helpers.getColor(seed, Helpers.ComponentBytes.LOGO)) % (uint8(type(Logo.LogoColors).max) + 1)
|
||||
);
|
||||
|
||||
str = string.concat(
|
||||
str,
|
||||
Body.getBody(bodyVariant, bodyColor, handsVariant, Hands.HandsColors(uint8(skinColor))),
|
||||
Logo.getLogo(logoVariant, logoColor, bodyVariant, bodyColor),
|
||||
Head.getHead(Head.HeadColors(uint8(skinColor))),
|
||||
Headwear.getHeadwear(seed, isGold)
|
||||
);
|
||||
}
|
||||
|
||||
Face.FaceVariants faceVariant = Face.FaceVariants(
|
||||
chosenElements.faceVariant = Face.FaceVariants(
|
||||
uint8(Helpers.getVariant(seed, Helpers.ComponentBytes.FACE)) % (uint8(type(Face.FaceVariants).max) + 1)
|
||||
);
|
||||
|
||||
chosenElements.isGold = isGold;
|
||||
|
||||
(headwearSvg, chosenElements.headwearVariant, chosenElements.headwearColor) = Headwear.getHeadwear(
|
||||
seed,
|
||||
isGold
|
||||
);
|
||||
|
||||
return (chosenElements, headwearSvg);
|
||||
}
|
||||
|
||||
function _generateSvgElements(
|
||||
ChosenElements memory chosenElements,
|
||||
string memory headwearSvg
|
||||
) internal pure returns (string memory) {
|
||||
return
|
||||
string.concat(
|
||||
str,
|
||||
Face.getFace(faceVariant, isGold ? Face.FaceColors.GOLD : Face.FaceColors.NORMAL),
|
||||
Hands.getHands(handsVariant, Hands.HandsColors(uint8(skinColor)), bodyVariant, bodyColor),
|
||||
isGold ? GoldSparkles.getGoldSparkles() : ''
|
||||
Legs.getLegs(chosenElements.legColor),
|
||||
Shoes.getShoes(chosenElements.shoeColor),
|
||||
Body.getBody(
|
||||
chosenElements.bodyVariant,
|
||||
chosenElements.bodyColor,
|
||||
chosenElements.handsVariant,
|
||||
Hands.HandsColors(uint8(chosenElements.skinColor))
|
||||
),
|
||||
Logo.getLogo(
|
||||
chosenElements.logoVariant,
|
||||
chosenElements.logoColor,
|
||||
chosenElements.bodyVariant,
|
||||
chosenElements.bodyColor
|
||||
),
|
||||
Head.getHead(Head.HeadColors(uint8(chosenElements.skinColor))),
|
||||
headwearSvg,
|
||||
Face.getFace(
|
||||
chosenElements.faceVariant,
|
||||
chosenElements.isGold ? Face.FaceColors.GOLD : Face.FaceColors.NORMAL
|
||||
),
|
||||
Hands.getHands(
|
||||
chosenElements.handsVariant,
|
||||
Hands.HandsColors(uint8(chosenElements.skinColor)),
|
||||
chosenElements.bodyVariant,
|
||||
chosenElements.bodyColor
|
||||
),
|
||||
chosenElements.isGold ? GoldSparkles.getGoldSparkles() : ''
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ contract ProfileTokenURI is IProfileTokenURI {
|
||||
|
||||
function getTokenURI(uint256 profileId, uint256 mintTimestamp) external pure override returns (string memory) {
|
||||
string memory profileIdAsString = profileId.toString();
|
||||
(string memory profileSvg, string memory traits) = ProfileSVG.getProfileSVG(profileId);
|
||||
return
|
||||
string(
|
||||
abi.encodePacked(
|
||||
@@ -24,7 +25,7 @@ contract ProfileTokenURI is IProfileTokenURI {
|
||||
'","description":"Lens Protocol - Profile #',
|
||||
profileIdAsString,
|
||||
'","image":"data:image/svg+xml;base64,',
|
||||
Base64.encode(bytes(ProfileSVG.getProfileSVG(profileId))),
|
||||
Base64.encode(bytes(profileSvg)),
|
||||
'","attributes":[{"display_type":"number","trait_type":"ID","value":"',
|
||||
profileIdAsString,
|
||||
'"},{"trait_type":"HEX ID","value":"',
|
||||
|
||||
Reference in New Issue
Block a user