Skip to content

Commit

Permalink
Merge pull request #1 from bhofmei/tmp-branch
Browse files Browse the repository at this point in the history
Tmp branch
  • Loading branch information
bhofmei committed May 30, 2017
2 parents f06aff4 + 5be58a5 commit f7014cf
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 8 deletions.
2 changes: 1 addition & 1 deletion js/Store/Util.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ define('NucleotideDensityPlugin/Store/Util',[
'dojo/_base/array',
'dojo/_base/lang',
'dojo/json',
'dojo/text!plugins/NucleotideDensityPlugin/js/nucleotide_table.json'
'dojo/text!plugins/NucleotideDensityPlugin/nucleotide_table.json'
],
function(
declare,
Expand Down
16 changes: 9 additions & 7 deletions js/View/ColorHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ define('NucleotideDensityPlugin/View/ColorHandler',[
'dojo/_base/declare',
'dojo/_base/array',
'dojo/_base/lang',
'dojo/_base/Color',
'./chroma'
],
function(
declare,
array,
lang,
dojoColor
chroma

){
/*
Expand All @@ -30,23 +30,26 @@ ColorHandler = {
},

generateNColors: function(n){
var thisB = this;
var s=100, l=65, sep=360/n;
var hs=[];
var i;
for(i=0; i < n; i++){
hs.push(sep*i);
}
var out = array.map(hs, function(h){
var t = dojoxColor.fromHsl(h, s, l);
return t.toHex();
var t = chroma.hcl(h,s,l);
return t.hex();
});
return out;
},

getFontColor: function(color){
// from https://stackoverflow.com/questions/1855884/determine-font-color-based-on-background-color
var bg = new dojoColor(color);
var rgb = bg.toRgb();
//var bg = new dojoColor(color);
var bg = chroma(color);
//var rgb = bg.toRgb();
var rgb = bg.rgb();
var a = 1 - ( 0.299 * rgb[0] + 0.587 * rgb[1] + 0.114 * rgb[2])/255;
if(a >= 0.5)
return '#F0F0F0';
Expand Down Expand Up @@ -96,7 +99,6 @@ ColorHandler = {
n %= colorList.length;
return colorList[n];
}

}
return ColorHandler;
});
33 changes: 33 additions & 0 deletions js/View/chroma.js

Large diffs are not rendered by default.

File renamed without changes.
3 changes: 3 additions & 0 deletions release_notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Release notes
v1.0 - Mar 16, 2017
- random color generation based on number of contexts
- uses chroma.js for color conversions in ColorHandler

v0.6 - Nov 21, 2016
- on hover over track, show density score for sequence contexts
Expand Down

0 comments on commit f7014cf

Please sign in to comment.