Merge pull request #6277 from appwrite/feat/avatar-colors
Update avatar font and default colors
This commit is contained in:
commit
c659c5978f
5 changed files with 10 additions and 11 deletions
BIN
app/assets/fonts/inter-v8-latin-regular.woff2
Normal file
BIN
app/assets/fonts/inter-v8-latin-regular.woff2
Normal file
Binary file not shown.
Binary file not shown.
|
@ -509,12 +509,11 @@ App::get('/v1/avatars/initials')
|
||||||
->action(function (string $name, int $width, int $height, string $background, Response $response, Document $user) {
|
->action(function (string $name, int $width, int $height, string $background, Response $response, Document $user) {
|
||||||
|
|
||||||
$themes = [
|
$themes = [
|
||||||
['background' => '#FFA1CE'], // Default (Pink)
|
['background' => '#FD366E'], // Default (Pink)
|
||||||
['background' => '#FDC584'], // Orange
|
['background' => '#FE9567'], // Orange
|
||||||
['background' => '#94DBD1'], // Green
|
['background' => '#7C67FE'], // Purple
|
||||||
['background' => '#A1C4FF'], // Blue
|
['background' => '#68A3FE'], // Blue
|
||||||
['background' => '#FFA1CE'], // Pink
|
['background' => '#85DBD8'], // Mint
|
||||||
['background' => '#CBB1FC'] // Purple
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$name = (!empty($name)) ? $name : $user->getAttribute('name', $user->getAttribute('email', ''));
|
$name = (!empty($name)) ? $name : $user->getAttribute('name', $user->getAttribute('email', ''));
|
||||||
|
@ -548,8 +547,8 @@ App::get('/v1/avatars/initials')
|
||||||
|
|
||||||
$punch->newImage($width, $height, 'transparent');
|
$punch->newImage($width, $height, 'transparent');
|
||||||
|
|
||||||
$draw->setFont(__DIR__ . "/../../assets/fonts/poppins-v9-latin-500.ttf");
|
$draw->setFont(__DIR__ . "/../../assets/fonts/inter-v8-latin-regular.woff2");
|
||||||
$image->setFont(__DIR__ . "/../../assets/fonts/poppins-v9-latin-500.ttf");
|
$image->setFont(__DIR__ . "/../../assets/fonts/inter-v8-latin-regular.woff2");
|
||||||
|
|
||||||
$draw->setFillColor(new ImagickPixel('black'));
|
$draw->setFillColor(new ImagickPixel('black'));
|
||||||
$draw->setFontSize($fontSize);
|
$draw->setFontSize($fontSize);
|
||||||
|
@ -724,7 +723,7 @@ App::get('/v1/cards/cloud')
|
||||||
|
|
||||||
$text = new \ImagickDraw();
|
$text = new \ImagickDraw();
|
||||||
$text->setTextAlignment(Imagick::ALIGN_CENTER);
|
$text->setTextAlignment(Imagick::ALIGN_CENTER);
|
||||||
$text->setFont(__DIR__ . '/../../../public/fonts/Poppins-Bold.ttf');
|
$text->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf');
|
||||||
$text->setFillColor(new \ImagickPixel('#FFFFFF'));
|
$text->setFillColor(new \ImagickPixel('#FFFFFF'));
|
||||||
|
|
||||||
if (\strlen($name) > 32) {
|
if (\strlen($name) > 32) {
|
||||||
|
@ -1108,7 +1107,7 @@ App::get('/v1/cards/cloud-og')
|
||||||
|
|
||||||
$textName = new \ImagickDraw();
|
$textName = new \ImagickDraw();
|
||||||
$textName->setTextAlignment(Imagick::ALIGN_CENTER);
|
$textName->setTextAlignment(Imagick::ALIGN_CENTER);
|
||||||
$textName->setFont(__DIR__ . '/../../../public/fonts/Poppins-Bold.ttf');
|
$textName->setFont(__DIR__ . '/../../../public/fonts/Inter-Bold.ttf');
|
||||||
$textName->setFillColor(new \ImagickPixel('#FFFFFF'));
|
$textName->setFillColor(new \ImagickPixel('#FFFFFF'));
|
||||||
|
|
||||||
if (\strlen($name) > 32) {
|
if (\strlen($name) > 32) {
|
||||||
|
|
|
@ -155,7 +155,7 @@ class AvatarsTest extends Scope
|
||||||
'x-appwrite-project' => $projectId,
|
'x-appwrite-project' => $projectId,
|
||||||
], $this->getHeaders()), $graphQLPayload);
|
], $this->getHeaders()), $graphQLPayload);
|
||||||
|
|
||||||
$this->assertEquals(4959, \strlen($initials['body']));
|
$this->assertEquals(5041, \strlen($initials['body']));
|
||||||
|
|
||||||
return $initials['body'];
|
return $initials['body'];
|
||||||
}
|
}
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 3 KiB After Width: | Height: | Size: 3 KiB |
Loading…
Reference in a new issue