aboutsummaryrefslogtreecommitdiff
path: root/src/app/identity-page/identity-page.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/identity-page/identity-page.component.ts')
-rw-r--r--src/app/identity-page/identity-page.component.ts20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/app/identity-page/identity-page.component.ts b/src/app/identity-page/identity-page.component.ts
index b193d5e..f347f44 100644
--- a/src/app/identity-page/identity-page.component.ts
+++ b/src/app/identity-page/identity-page.component.ts
@@ -11,14 +11,14 @@
11 WITHOUT ANY WARRANTY; without even the implied warranty of 11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Affero General Public License for more details. 13 Affero General Public License for more details.
14 14
15 You should have received a copy of the GNU Affero General Public License 15 You should have received a copy of the GNU Affero General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>. 16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18/** 18/**
19 * @author Philippe Buschmann 19 * @author Philippe Buschmann
20 * @file src/app/identity-page/identity-page.component.ts 20 * @file src/app/identity-page/identity-page.component.ts
21 * @brief 21 * @brief
22 * 22 *
23 */ 23 */
24 24
@@ -112,4 +112,20 @@ export class IdentityPageComponent implements OnInit {
112 }); 112 });
113 } 113 }
114 114
115 intFromHash(str:string): number{
116 let hash: number = 0;
117 for (var i = 0; i < str.length; i++) {
118 hash = str.charCodeAt(i) + ((hash << 5)-hash);
119 hash = hash & hash;
120 }
121 return (Math.abs(hash)/4294967295);
122 }
123
124 returnHSL(id:string): string{
125 return "hsl(" + 360 * this.intFromHash(id) + ',' +
126 (90 + 70 * this.intFromHash(id)) + '%,' +
127 (85 + 10 * this.intFromHash(id)) + '%)';
128 }
129
130
115} 131}