Adjust identicons to match ivatar (10x10, padding, colors, retro = identicon).
the build was successful
Details
the build was successful
Details
This commit is contained in:
parent
abe643bb6c
commit
fba5c64486
|
@ -1,6 +1,6 @@
|
||||||
cmake_minimum_required (VERSION 3.2)
|
cmake_minimum_required (VERSION 3.2)
|
||||||
project(libravatarserv
|
project(libravatarserv
|
||||||
VERSION 0.7.1
|
VERSION 0.7.2
|
||||||
LANGUAGES CXX
|
LANGUAGES CXX
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ The API is explained in greater detail at the
|
||||||
|
|
||||||
* OpenID
|
* OpenID
|
||||||
* Because it isn't possible to store filenames with '/' in it on most filesystems.
|
* Because it isn't possible to store filenames with '/' in it on most filesystems.
|
||||||
* The default fallbacks monsterid, wavatar, retro and robohash
|
* The default fallbacks monsterid, wavatar and robohash
|
||||||
* Patches welcome
|
* Patches welcome
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
|
@ -101,28 +101,33 @@ int main()
|
||||||
goto not_implemented;
|
goto not_implemented;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (avatar.fallback.substr(0, 9) == "identicon")
|
else if (avatar.fallback.substr(0, 9) == "identicon" ||
|
||||||
|
avatar.fallback.substr(0, 5) == "retro")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Identiconpp identicon(4, 4, Identiconpp::algorithm::sigil,
|
uint8_t padwidth = avatar.size / 10;
|
||||||
"ffffffff",
|
if (avatar.size < 60)
|
||||||
{ // The 16 named colors specified in HTML 4.01
|
{
|
||||||
// minus white, silver and gray.
|
padwidth = 0;
|
||||||
"000000ff", // Black
|
}
|
||||||
"ff0000ff", // Red
|
else if (padwidth < 10)
|
||||||
"800000ff", // Maroon
|
{
|
||||||
"ffff00ff", // Yellow
|
padwidth = 10;
|
||||||
"808000ff", // Olive
|
}
|
||||||
"00ff00ff", // lime
|
|
||||||
"008000ff", // Green
|
Identiconpp identicon(10, 10, Identiconpp::algorithm::sigil,
|
||||||
"00ffffff", // Aqua
|
"#fefefe",
|
||||||
"008080ff", // Teal
|
{ // The same colors ivatar uses.
|
||||||
"0000ffff", // Blue
|
"2d4fffff", // Blue
|
||||||
"000080ff", // Navy
|
"feb42cff", // Yellow
|
||||||
"ff00ffff", // Fuchsia
|
"e279eaff", // Bright pink
|
||||||
"800080ff", // Purple
|
"1eb3fdff", // Cyan
|
||||||
});
|
"E84D41ff", // Red
|
||||||
|
"31CB73ff", // Green
|
||||||
|
"8D45AAff" // Dark pink
|
||||||
|
},
|
||||||
|
{ padwidth, padwidth });
|
||||||
image.image = identicon.generate(avatar.digest, avatar.size);
|
image.image = identicon.generate(avatar.digest, avatar.size);
|
||||||
image.image.magick("PNG");
|
image.image.magick("PNG");
|
||||||
image::write(image);
|
image::write(image);
|
||||||
|
|
Loading…
Reference in New Issue