Skip to content
This repository has been archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
fix: fix color hash negative numbers
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Apr 17, 2019
1 parent 7849626 commit 90d20d1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions front/src/helpers/colorHash.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ export function colorHash(inputString: string) {
sum += i.charCodeAt(0)
}

const r = ~~(Math.sin(sum + 1) * 256)
const g = ~~(Math.sin(sum + 2) * 256)
const b = ~~(Math.sin(sum + 3) * 256)
const r = Math.abs(~~(Math.sin(sum + 1) * 256))
const g = Math.abs(~~(Math.sin(sum + 2) * 256))
const b = Math.abs(~~(Math.sin(sum + 3) * 256))

let hex = '#'

Expand Down

0 comments on commit 90d20d1

Please sign in to comment.