From 6bbef3eda4008b38e7c3969f513b062cb1f15228 Mon Sep 17 00:00:00 2001 From: Brian Ward Date: Mon, 5 Aug 2024 18:47:48 +0000 Subject: [PATCH] Style scrollbar in chrome --- gui/src/app/Scripting/OutputDivUtils.tsx | 3 +- gui/src/index.css | 36 ++++++++++++++++-------- gui/src/localStyles.css | 18 ++++++++++++ 3 files changed, 43 insertions(+), 14 deletions(-) diff --git a/gui/src/app/Scripting/OutputDivUtils.tsx b/gui/src/app/Scripting/OutputDivUtils.tsx index 11558a91..7f844ca9 100644 --- a/gui/src/app/Scripting/OutputDivUtils.tsx +++ b/gui/src/app/Scripting/OutputDivUtils.tsx @@ -9,11 +9,10 @@ export const writeConsoleOutToDiv = ( ) => { if (x === "") return; if (!parentDiv.current) return; - const styleClass = type === "stdout" ? "WorkerStdout" : "WorkerStderr"; const preElement = document.createElement("pre"); preElement.textContent = x; const divElement = document.createElement("div"); - divElement.className = styleClass; + divElement.className = type; divElement.appendChild(preElement); parentDiv.current.appendChild(divElement); }; diff --git a/gui/src/index.css b/gui/src/index.css index ddfee086..3edd5bee 100644 --- a/gui/src/index.css +++ b/gui/src/index.css @@ -4,20 +4,32 @@ body { min-height: 100vh; } -.WorkerStdout { - color: darkblue; +@supports (scrollbar-width: auto) { + body { + scrollbar-width: thin; + } } -.WorkerStdout pre { - margin: 0px; - padding: 1px; -} +@supports selector(::-webkit-scrollbar) { + ::-webkit-scrollbar { + width: 3px; + height: 3px; + } -.WorkerStderr { - color: red; -} + :hover::-webkit-scrollbar { + width: 6px; + height: 6px; + } + + ::-webkit-scrollbar-track { + background: #f2f2f2; + } + + ::-webkit-scrollbar-thumb { + background: #bdbdbd; + } -.WorkerStderr pre { - margin: 0px; - padding: 1px; + ::-webkit-scrollbar-thumb:hover { + background: #6e6e6e; + } } diff --git a/gui/src/localStyles.css b/gui/src/localStyles.css index 947192be..97ce7d40 100644 --- a/gui/src/localStyles.css +++ b/gui/src/localStyles.css @@ -27,6 +27,24 @@ white-space: pre-wrap; } +.stdout { + color: darkblue; +} + +.stdout pre { + margin: 0px; + padding: 1px; +} + +.stderr { + color: red; +} + +.stderr pre { + margin: 0px; + padding: 1px; +} + /* Compilation Results (StanCompileResultWindow) */ .ErrorsWindow { height: 100%;