Skip to content

Commit

Permalink
add backgroundColor to tokenURI (#62)
Browse files Browse the repository at this point in the history
* fix: glint was in there twice

* change: token name and description

* chore: makes Glint plural to Glints

Co-authored-by: Nick Beattie <[email protected]>
  • Loading branch information
g-a-v-i-n and nickbytes authored Jul 13, 2022
1 parent 405f3bc commit efa930c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 3 additions & 0 deletions src/libraries/Metadata.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ library Metadata {
string memory _name,
string memory _description,
string memory _attributes,
string memory _backgroundColor,
string memory _svg
) internal pure returns (string memory) {
string memory metadata = string.concat(
Expand All @@ -31,6 +32,8 @@ library Metadata {
",",
Util.keyValueNoQuotes("attributes", _attributes),
",",
Util.keyValue("backgroundColor", _backgroundColor),
",",
Util.keyValue("image", encodeSvg(_svg)),
"}"
);
Expand Down
6 changes: 4 additions & 2 deletions src/libraries/Render.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ import {Glints} from "./Glints.sol";
import {Traits} from "./Traits.sol";
import {SVG} from "./SVG.sol";
import {Data} from "./Data.sol";
import {Palette} from "./Palette.sol";

library Render {
function tokenURI(uint256 _tokenId, bytes32 _seed) internal pure returns (string memory) {
return
string(
Metadata.encodeTokenMetadata(
_tokenId,
tokenName("Bibo #", _tokenId), // name
"Bibos", // description
tokenName("Bibo ", _tokenId), // name
"Bibo bibo bibo", // description
Traits.getTraits(_seed), // attributes
Palette.getBackgroundFill(_seed), // backgroundColor
svg(_seed) // svg
)
);
Expand Down
3 changes: 1 addition & 2 deletions src/libraries/Traits.sol
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@ library Traits {
string memory result = "[";
result = string.concat(result, trait("Density", getDensityTrait(_seed)));
result = string.concat(result, ",", trait("Polarity", getPolarityTrait(_seed)));
result = string.concat(result, ",", trait("Glint", getGlintTrait(_seed)));
result = string.concat(result, ",", trait("Glints", getGlintTrait(_seed)));
result = string.concat(result, ",", trait("Mote", getMoteTrait(_seed)));
result = string.concat(result, ",", trait("Eyes", getEyeTrait(_seed)));
result = string.concat(result, ",", trait("Mouth", getMouthTrait(_seed)));
result = string.concat(result, ",", trait("Cheeks", getCheekTrait(_seed)));
result = string.concat(result, ",", trait("Glints", getGlintTrait(_seed)));
return string.concat(result, "]");
}

Expand Down

0 comments on commit efa930c

Please sign in to comment.