Skip to content

Commit

Permalink
Merge pull request #217 from alexcorre/colors-tweaks
Browse files Browse the repository at this point in the history
Colors tweaks
  • Loading branch information
alexcorre authored Dec 11, 2017
2 parents a899071 + 9474d8d commit 4b25737
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
28 changes: 14 additions & 14 deletions lib/components/BlameLine.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ function lastWord(str) {
}

function stringToColour(str) {
if(colours[str]) {
if (colours[str]) {
return colours[str];
} else {
var hash = 0;
for (var i = 0; i < str.length; i++) {
hash = str.charCodeAt(i) + ((hash << 5) - hash);
}
var colour = '#';
for (var i = 0; i < 3; i++) {
var value = (hash >> (i * 8)) & 0xFF;
colour += ('00' + value.toString(16)).substr(-2);
}
colours[str] = colour;
return colour;
}

let hash = 0;
for (let i = 0; i < str.length; i++) { // eslint-disable-line no-plusplus
hash = str.charCodeAt(i) + ((hash << 5) - hash); // eslint-disable-line no-bitwise
}
let colour = '#';
for (let i = 0; i < 3; i++) { // eslint-disable-line no-plusplus
var value = (hash >> (i * 8)) & 0xFF; // eslint-disable-line no-bitwise
colour += (`00${value.toString(16)}`).substr(-2);
}
colours[str] = colour;
return colour;
}

export default function BlameLine(props) {
Expand All @@ -42,7 +42,7 @@ export default function BlameLine(props) {

const displayName = showOnlyLastNames ? lastWord(author) : author;
return (
<div className={`blame-line ${className}`} style={{ borderRight: colorCommitAuthors ? `thick solid ${stringToColour(author)}` : 'none' }}>
<div className={`blame-line ${className}`} style={{ borderRight: colorCommitAuthors ? `2px solid ${stringToColour(author)}` : 'none' }}>
<a href={viewCommitUrl}>
{showHash ? <span className="hash">{hash.substring(0, HASH_LENGTH)}</span> : null}
<span className="date">{date}</span>
Expand Down
4 changes: 2 additions & 2 deletions lib/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export default {
type: 'boolean',
default: true,
},
colorCommitAuthors : {
colorCommitAuthors: {
type: 'boolean',
default: true
default: false,
},
};

0 comments on commit 4b25737

Please sign in to comment.