forked from go-gitea/gitea
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Better builtin avatar generator (go-gitea#17707)
This PR fixes the builtin avatar generator. 1. The random background color makes some images very dirty. So now we only use white background for avatars. 2. We use left-right mirror avatars to satisfy go-gitea#14799 3. Fix a small padding error in the algorithm
- Loading branch information
1 parent
4262a1c
commit 3226a04
Showing
19 changed files
with
417 additions
and
376 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
// Copyright 2021 The Gitea Authors. All rights reserved. | ||
// Use of this source code is governed by a MIT-style | ||
// license that can be found in the LICENSE file. | ||
|
||
package identicon | ||
|
||
import "image/color" | ||
|
||
// DarkColors are dark colors for avatar blocks, they come from image/color/palette.WebSafe, and light colors (0xff) are removed | ||
var DarkColors = []color.Color{ | ||
color.RGBA{0x00, 0x00, 0x33, 0xff}, | ||
color.RGBA{0x00, 0x00, 0x66, 0xff}, | ||
color.RGBA{0x00, 0x00, 0x99, 0xff}, | ||
color.RGBA{0x00, 0x00, 0xcc, 0xff}, | ||
color.RGBA{0x00, 0x33, 0x00, 0xff}, | ||
color.RGBA{0x00, 0x33, 0x33, 0xff}, | ||
color.RGBA{0x00, 0x33, 0x66, 0xff}, | ||
color.RGBA{0x00, 0x33, 0x99, 0xff}, | ||
color.RGBA{0x00, 0x33, 0xcc, 0xff}, | ||
color.RGBA{0x00, 0x66, 0x00, 0xff}, | ||
color.RGBA{0x00, 0x66, 0x33, 0xff}, | ||
color.RGBA{0x00, 0x66, 0x66, 0xff}, | ||
color.RGBA{0x00, 0x66, 0x99, 0xff}, | ||
color.RGBA{0x00, 0x66, 0xcc, 0xff}, | ||
color.RGBA{0x00, 0x99, 0x00, 0xff}, | ||
color.RGBA{0x00, 0x99, 0x33, 0xff}, | ||
color.RGBA{0x00, 0x99, 0x66, 0xff}, | ||
color.RGBA{0x00, 0x99, 0x99, 0xff}, | ||
color.RGBA{0x00, 0x99, 0xcc, 0xff}, | ||
color.RGBA{0x00, 0xcc, 0x00, 0xff}, | ||
color.RGBA{0x00, 0xcc, 0x33, 0xff}, | ||
color.RGBA{0x00, 0xcc, 0x66, 0xff}, | ||
color.RGBA{0x00, 0xcc, 0x99, 0xff}, | ||
color.RGBA{0x00, 0xcc, 0xcc, 0xff}, | ||
color.RGBA{0x33, 0x00, 0x00, 0xff}, | ||
color.RGBA{0x33, 0x00, 0x33, 0xff}, | ||
color.RGBA{0x33, 0x00, 0x66, 0xff}, | ||
color.RGBA{0x33, 0x00, 0x99, 0xff}, | ||
color.RGBA{0x33, 0x00, 0xcc, 0xff}, | ||
color.RGBA{0x33, 0x33, 0x00, 0xff}, | ||
color.RGBA{0x33, 0x33, 0x33, 0xff}, | ||
color.RGBA{0x33, 0x33, 0x66, 0xff}, | ||
color.RGBA{0x33, 0x33, 0x99, 0xff}, | ||
color.RGBA{0x33, 0x33, 0xcc, 0xff}, | ||
color.RGBA{0x33, 0x66, 0x00, 0xff}, | ||
color.RGBA{0x33, 0x66, 0x33, 0xff}, | ||
color.RGBA{0x33, 0x66, 0x66, 0xff}, | ||
color.RGBA{0x33, 0x66, 0x99, 0xff}, | ||
color.RGBA{0x33, 0x66, 0xcc, 0xff}, | ||
color.RGBA{0x33, 0x99, 0x00, 0xff}, | ||
color.RGBA{0x33, 0x99, 0x33, 0xff}, | ||
color.RGBA{0x33, 0x99, 0x66, 0xff}, | ||
color.RGBA{0x33, 0x99, 0x99, 0xff}, | ||
color.RGBA{0x33, 0x99, 0xcc, 0xff}, | ||
color.RGBA{0x33, 0xcc, 0x00, 0xff}, | ||
color.RGBA{0x33, 0xcc, 0x33, 0xff}, | ||
color.RGBA{0x33, 0xcc, 0x66, 0xff}, | ||
color.RGBA{0x33, 0xcc, 0x99, 0xff}, | ||
color.RGBA{0x33, 0xcc, 0xcc, 0xff}, | ||
color.RGBA{0x66, 0x00, 0x00, 0xff}, | ||
color.RGBA{0x66, 0x00, 0x33, 0xff}, | ||
color.RGBA{0x66, 0x00, 0x66, 0xff}, | ||
color.RGBA{0x66, 0x00, 0x99, 0xff}, | ||
color.RGBA{0x66, 0x00, 0xcc, 0xff}, | ||
color.RGBA{0x66, 0x33, 0x00, 0xff}, | ||
color.RGBA{0x66, 0x33, 0x33, 0xff}, | ||
color.RGBA{0x66, 0x33, 0x66, 0xff}, | ||
color.RGBA{0x66, 0x33, 0x99, 0xff}, | ||
color.RGBA{0x66, 0x33, 0xcc, 0xff}, | ||
color.RGBA{0x66, 0x66, 0x00, 0xff}, | ||
color.RGBA{0x66, 0x66, 0x33, 0xff}, | ||
color.RGBA{0x66, 0x66, 0x66, 0xff}, | ||
color.RGBA{0x66, 0x66, 0x99, 0xff}, | ||
color.RGBA{0x66, 0x66, 0xcc, 0xff}, | ||
color.RGBA{0x66, 0x99, 0x00, 0xff}, | ||
color.RGBA{0x66, 0x99, 0x33, 0xff}, | ||
color.RGBA{0x66, 0x99, 0x66, 0xff}, | ||
color.RGBA{0x66, 0x99, 0x99, 0xff}, | ||
color.RGBA{0x66, 0x99, 0xcc, 0xff}, | ||
color.RGBA{0x66, 0xcc, 0x00, 0xff}, | ||
color.RGBA{0x66, 0xcc, 0x33, 0xff}, | ||
color.RGBA{0x66, 0xcc, 0x66, 0xff}, | ||
color.RGBA{0x66, 0xcc, 0x99, 0xff}, | ||
color.RGBA{0x66, 0xcc, 0xcc, 0xff}, | ||
color.RGBA{0x99, 0x00, 0x00, 0xff}, | ||
color.RGBA{0x99, 0x00, 0x33, 0xff}, | ||
color.RGBA{0x99, 0x00, 0x66, 0xff}, | ||
color.RGBA{0x99, 0x00, 0x99, 0xff}, | ||
color.RGBA{0x99, 0x00, 0xcc, 0xff}, | ||
color.RGBA{0x99, 0x33, 0x00, 0xff}, | ||
color.RGBA{0x99, 0x33, 0x33, 0xff}, | ||
color.RGBA{0x99, 0x33, 0x66, 0xff}, | ||
color.RGBA{0x99, 0x33, 0x99, 0xff}, | ||
color.RGBA{0x99, 0x33, 0xcc, 0xff}, | ||
color.RGBA{0x99, 0x66, 0x00, 0xff}, | ||
color.RGBA{0x99, 0x66, 0x33, 0xff}, | ||
color.RGBA{0x99, 0x66, 0x66, 0xff}, | ||
color.RGBA{0x99, 0x66, 0x99, 0xff}, | ||
color.RGBA{0x99, 0x66, 0xcc, 0xff}, | ||
color.RGBA{0x99, 0x99, 0x00, 0xff}, | ||
color.RGBA{0x99, 0x99, 0x33, 0xff}, | ||
color.RGBA{0x99, 0x99, 0x66, 0xff}, | ||
color.RGBA{0x99, 0x99, 0x99, 0xff}, | ||
color.RGBA{0x99, 0x99, 0xcc, 0xff}, | ||
color.RGBA{0x99, 0xcc, 0x00, 0xff}, | ||
color.RGBA{0x99, 0xcc, 0x33, 0xff}, | ||
color.RGBA{0x99, 0xcc, 0x66, 0xff}, | ||
color.RGBA{0x99, 0xcc, 0x99, 0xff}, | ||
color.RGBA{0x99, 0xcc, 0xcc, 0xff}, | ||
color.RGBA{0xcc, 0x00, 0x00, 0xff}, | ||
color.RGBA{0xcc, 0x00, 0x33, 0xff}, | ||
color.RGBA{0xcc, 0x00, 0x66, 0xff}, | ||
color.RGBA{0xcc, 0x00, 0x99, 0xff}, | ||
color.RGBA{0xcc, 0x00, 0xcc, 0xff}, | ||
color.RGBA{0xcc, 0x33, 0x00, 0xff}, | ||
color.RGBA{0xcc, 0x33, 0x33, 0xff}, | ||
color.RGBA{0xcc, 0x33, 0x66, 0xff}, | ||
color.RGBA{0xcc, 0x33, 0x99, 0xff}, | ||
color.RGBA{0xcc, 0x33, 0xcc, 0xff}, | ||
color.RGBA{0xcc, 0x66, 0x00, 0xff}, | ||
color.RGBA{0xcc, 0x66, 0x33, 0xff}, | ||
color.RGBA{0xcc, 0x66, 0x66, 0xff}, | ||
color.RGBA{0xcc, 0x66, 0x99, 0xff}, | ||
color.RGBA{0xcc, 0x66, 0xcc, 0xff}, | ||
color.RGBA{0xcc, 0x99, 0x00, 0xff}, | ||
color.RGBA{0xcc, 0x99, 0x33, 0xff}, | ||
color.RGBA{0xcc, 0x99, 0x66, 0xff}, | ||
color.RGBA{0xcc, 0x99, 0x99, 0xff}, | ||
color.RGBA{0xcc, 0x99, 0xcc, 0xff}, | ||
color.RGBA{0xcc, 0xcc, 0x00, 0xff}, | ||
color.RGBA{0xcc, 0xcc, 0x33, 0xff}, | ||
color.RGBA{0xcc, 0xcc, 0x66, 0xff}, | ||
color.RGBA{0xcc, 0xcc, 0x99, 0xff}, | ||
color.RGBA{0xcc, 0xcc, 0xcc, 0xff}, | ||
} |
Oops, something went wrong.