Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions byubit/renderers/html/render_bit.html
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,18 @@ <h2>Run at: %%TIMESTAMP%%</h2>
let currentTab = null;
let currentIndex = {};


// Wrote by Alessandro
const COLOR_MAP = {
red: "#C0392B",
green: "#009E73",
blue: "#0072B2",
white: "white",
black: "black",
};



function hasError(history) {
return history[history.length - 1].error_message != null;
}
Expand Down Expand Up @@ -475,7 +487,11 @@ <h2>Run at: %%TIMESTAMP%%</h2>
cell.className = 'cell';
cell.style.width = `${cellWidth}px`;
cell.style.height = `${cellHeight}px`;
cell.style.backgroundColor = cellColor;

// Modified to make it color-blind friendly
cell.style.backgroundColor = COLOR_MAP[cellColor] ?? cellColor;


if (row === pos[0] && col === pos[1]) {
const triangle = document.createElement('div');
triangle.className = 'triangle';
Expand Down Expand Up @@ -507,7 +523,7 @@ <h2>Run at: %%TIMESTAMP%%</h2>
const annotation = record.annotations[0][row][col];
const acell = document.createElement('div');
acell.textContent = '!';
acell.style.backgroundColor = annotation;
acell.style.backgroundColor = COLOR_MAP[annotation] ?? annotation;
if (annotation === "white") {
acell.style.color = "black";
}
Expand Down
20 changes: 20 additions & 0 deletions new_colors_Aless.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
from byubit import Bit


@Bit.empty_world(5,5)
def main(bit):
bit.paint("green")

bit.move()
bit.move()

bit.paint('blue')

bit.move()
bit.move()

bit.paint('red')


if __name__ == '__main__':
main(Bit.new_bit)
Loading