Skip to content

Commit 580c09f

Browse files
committed
added clustal coloring scheme
1 parent 568be71 commit 580c09f

File tree

1 file changed

+119
-17
lines changed

1 file changed

+119
-17
lines changed

index.html

Lines changed: 119 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -454,8 +454,8 @@
454454

455455
 Coloring Scheme:
456456
<select id="colorScheme">
457-
<option value="original" style="background-color: blue">original</option>
458-
<option value="new" style="background-color: green">Clustal</option>
457+
<option value="original" style="background-color: blue">Original</option>
458+
<option value="clustal" style="background-color: green">Clustal</option>
459459
</select>
460460
<br/>
461461

@@ -709,21 +709,123 @@ <h4><b>Privacy Policy</b></h4>
709709
<script>
710710
//PART 1 in javascript:
711711
//$("#colorScheme").change(function() { document.body.className = $('option:selected', this).text(); });
712-
function colorlist(){
713-
console.log('A .......');
714-
elem = document.querySelector('.c0');
715-
elem.style.setProperty('color', "#ffff00");
716-
elem = document.querySelector('.c1');
717-
elem.style.setProperty('color', "#ffff00");
718-
elem = document.querySelector('.c2');
719-
elem.style.setProperty('color', "#ffff00");
720-
elem = document.querySelector('.c3');
721-
elem.style.setProperty('color', "#ffff00");
722-
elem = document.querySelector('.c7');
723-
elem.style.setProperty('color', "#ffff00");
724-
console.log('B .......');
725-
}
726-
document.getElementById("colorScheme").onchange = colorlist;
712+
// console.log('A .......');
713+
// elem = document.querySelectorAll('.c0');
714+
// for(var i=0; i<elem.length; i++){
715+
// elem[i].style.setProperty('color', "#ffff00");
716+
// }
717+
// elem = document.querySelectorAll('.c1');
718+
// for(var i=0; i<elem.length; i++){
719+
// elem[i].style.setProperty('color', "#ffff00");
720+
// }
721+
// elem = document.querySelectorAll('.c2');
722+
// for(var i=0; i<elem.length; i++){
723+
// elem[i].style.setProperty('color', "#ffff00");
724+
// }
725+
// elem = document.querySelectorAll('.c3');
726+
// for(var i=0; i<elem.length; i++){
727+
// elem[i].style.setProperty('color', "#ffff00");
728+
// }
729+
// elem = document.querySelectorAll('.c7');
730+
// for(var i=0; i<elem.length; i++){
731+
// elem[i].style.setProperty('color', "#ffff00");
732+
// }
733+
// console.log('B .......');
734+
// }
735+
// document.getElementById("colorScheme").onchange = colorlist;
736+
737+
$(document).ready(function () {
738+
$('body').on('change','#colorScheme', function() {
739+
740+
var dict = {'.c0' :'#33cc00',
741+
'.c1' :'#009900',
742+
'.c2' :'#ffff00',
743+
'.c3' :'#33cc00',
744+
'.c4' :'#cc0000',
745+
'.c5' :'#0033ff',
746+
'.c6' :'#6600cc',
747+
'.c7' :'#0099ff',
748+
'.c8' :'#666666',
749+
'.c9' :'#999999',
750+
'.t0' :'#5858a7',
751+
'.t1' :'#6b6b94',
752+
'.t2' :'#64649b',
753+
'.t3' :'#2121de',
754+
'.t4' :'#9d9d62',
755+
'.t5' :'#8c8c73',
756+
'.t6' :'#0000ff',
757+
'.t7' :'#4949b6',
758+
'.t8' :'#60609f',
759+
'.t9' :'#ecec13',
760+
'.t10':'#b2b24d',
761+
'.t11':'#4747b8',
762+
'.t12':'#82827d',
763+
'.t13':'#c2c23d',
764+
'.t14':'#2323dc',
765+
'.t15':'#4949b6',
766+
'.t16':'#9d9d62',
767+
'.t17':'#c0c03f',
768+
'.t18':'#d3d32c',
769+
'.t19':'#ffff00'};
770+
771+
if (this.value == 'clustal'){
772+
// http://www.jalview.org/help/html/colourSchemes/clustal.html
773+
var dict = {'.c0' :'#f09048',
774+
'.c1' :'#15a4a4',
775+
'.c2' :'#f08080',
776+
'.c3' :'#c0c000',
777+
'.c4' :'#f01505',
778+
'.c5' :'#c048c0',
779+
'.c6' :'#15c015',
780+
'.c7' :'#15c015',
781+
'.c8' :'#666666',
782+
'.c9' :'#999999',
783+
'.t0' :'#5858a7',
784+
'.t1' :'#6b6b94',
785+
'.t2' :'#64649b',
786+
'.t3' :'#2121de',
787+
'.t4' :'#9d9d62',
788+
'.t5' :'#8c8c73',
789+
'.t6' :'#0000ff',
790+
'.t7' :'#15c015',
791+
'.t8' :'#60609f',
792+
'.t9' :'#ecec13',
793+
'.t10':'#b2b24d',
794+
'.t11':'#4747b8',
795+
'.t12':'#82827d',
796+
'.t13':'#c2c23d',
797+
'.t14':'#2323dc',
798+
'.t15':'#4949b6',
799+
'.t16':'#9d9d62',
800+
'.t17':'#c0c03f',
801+
'.t18':'#d3d32c',
802+
'.t19':'#ffff00'};
803+
}
804+
805+
806+
console.log('B .......');
807+
console.log(this.value);
808+
809+
810+
for(var key in dict) {
811+
var color = dict[key];
812+
813+
//get the elements with the color
814+
elem = document.querySelectorAll(key);
815+
for(var i=0; i<elem.length; i++){
816+
//Set the color
817+
elem[i].style.setProperty('color', color);
818+
}
819+
}
820+
821+
822+
});
823+
});
824+
825+
// original
826+
// clustal
827+
828+
727829
</script>
728830
</body>
729831
</html>

0 commit comments

Comments
 (0)