diff --git a/byubit/renderers/html/render_bit.html b/byubit/renderers/html/render_bit.html index 2f8d23d..d196d52 100644 --- a/byubit/renderers/html/render_bit.html +++ b/byubit/renderers/html/render_bit.html @@ -261,6 +261,18 @@

Run at: %%TIMESTAMP%%

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; } @@ -475,7 +487,11 @@

Run at: %%TIMESTAMP%%

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'; @@ -507,7 +523,7 @@

Run at: %%TIMESTAMP%%

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"; } diff --git a/new_colors_Aless.py b/new_colors_Aless.py new file mode 100644 index 0000000..bcd5b0d --- /dev/null +++ b/new_colors_Aless.py @@ -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) \ No newline at end of file