Skip to content

Commit

Permalink
fix default bands color specification
Browse files Browse the repository at this point in the history
  • Loading branch information
eimrek committed Apr 10, 2024
1 parent 57924fc commit 6bb0c59
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ function App() {
<BandsVisualizer
bandsDataList={[si_bands]}
energyRange={[-10.0, 10.0]}
bandsColorInfo={["red"]}
/>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/lib/jqueryBands/bands.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function bandPlot(

if (colorInfo !== undefined) {
if (typeof colorInfo[dataIdx] === "object") {
var newColor = tinycolor("red");
var newColor = tinycolor("black");
colorDict = [newColor, colorInfo[dataIdx][0], colorInfo[dataIdx][1]];
} else if (typeof colorInfo[dataIdx] === "string") {
var newColor = tinycolor(colorInfo[dataIdx]);
Expand All @@ -110,8 +110,8 @@ function bandPlot(
newColor.brighten(20).toHexString(),
];
} else {
// default bandstructure color is red
var newColor = tinycolor("red");
// default bandstructure color is black
var newColor = tinycolor("black");
colorDict = [
newColor.toHexString(),
newColor.darken(20).toHexString(),
Expand Down
2 changes: 1 addition & 1 deletion src/lib/jqueryBands/bandstructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ BandPlot.prototype.addBandStructure = function (bandsData, colorInfo) {
"#ff7f00",
];

if (!colorInfo || colorInfo.length) {
if (!colorInfo) {
var nextIndex = this.allColorInfo.length;
var newColor = tinycolor(defaultColors[nextIndex % defaultColors.length]);
colorInfo = [
Expand Down

0 comments on commit 6bb0c59

Please sign in to comment.