Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
feat: Attempted theme colours although not fully supported.
Browse files Browse the repository at this point in the history
  • Loading branch information
anirbanbasu committed May 12, 2024
1 parent 811a578 commit 729c334
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 3 deletions.
4 changes: 4 additions & 0 deletions pages/chatbot.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ def stream_wrapper(streaming_response):
def Page():
# Remove the "This website runs on Solara" message
solara.Style(constants.UI_SOLARA_NOTICE_REMOVE)
global_state.set_theme_colours()

global_state.initialise_default_settings()

Expand Down Expand Up @@ -161,6 +162,9 @@ def call_chat_engine():
style={"color": "#FFFFFF"},
)

with solara.AppBar():
solara.lab.ThemeToggle()

with rv.Snackbar(
top=True,
right=True,
Expand Down
4 changes: 4 additions & 0 deletions pages/ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ def Page():
"""Main settings page."""
# Remove the "This website runs on Solara" message
solara.Style(constants.UI_SOLARA_NOTICE_REMOVE)
global_state.set_theme_colours()
global_state.initialise_default_settings()

with solara.Head():
Expand All @@ -752,6 +753,9 @@ def Page():
with solara.AppBarTitle():
solara.Text("Ingest data", style={"color": "#FFFFFF"})

with solara.AppBar():
solara.lab.ThemeToggle()

with rv.Snackbar(
top=True,
right=True,
Expand Down
7 changes: 4 additions & 3 deletions pages/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,11 @@ def update_llm_system_message(callback_data: Any = None):
)
rv.Textarea(
label="System message",
clearable=True,
counter=True,
no_resize=True,
v_model=global_state.global_settings__llm_system_message.value,
on_v_model=update_llm_system_message,
rows=4,
)
# update_llm_settings()


@solara.component
Expand Down Expand Up @@ -396,6 +393,7 @@ def Page():
"""Main settings page."""
# Remove the "This website runs on Solara" message
solara.Style(constants.UI_SOLARA_NOTICE_REMOVE)
global_state.set_theme_colours()

global_state.initialise_default_settings()

Expand All @@ -405,6 +403,9 @@ def Page():
with solara.AppBarTitle():
solara.Text("Settings", style={"color": "#FFFFFF"})

with solara.AppBar():
solara.lab.ThemeToggle()

with rv.ExpansionPanels(popout=True, hover=True, accordion=True):
with rv.ExpansionPanel():
with rv.ExpansionPanelHeader():
Expand Down
42 changes: 42 additions & 0 deletions utils/global_state.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
from llama_index.core.memory import ChatMemoryBuffer

from typing import Any, List
import solara.lab
from typing_extensions import TypedDict

import utils.constants as constants
Expand Down Expand Up @@ -498,3 +499,44 @@ def initialise_default_settings():
update_index_documents_storage_context()

global_settings_initialised.value = True


def set_theme_colours():
"""Set the theme colours for the Solara app."""
# solara.lab.theme.themes.light.primary = "#3E5F90"
# solara.lab.theme.themes.light.onPrimary = "#FFFFFF"
# solara.lab.theme.themes.light.secondary = "#555F71"
# solara.lab.theme.themes.light.onSecondary = "#FFFFFF"
# solara.lab.theme.themes.light.accent = "#00687B"
# solara.lab.theme.themes.light.onAccent = "#FFFFFF"
# solara.lab.theme.themes.light.info = "#00c3ff"
# solara.lab.theme.themes.light.success = "#a3e635"
# solara.lab.theme.themes.light.warning = "#facc15"
# solara.lab.theme.themes.light.error = "#f87171"

# solara.lab.theme.themes.dark.primary = "#A7C8FF"
# solara.lab.theme.themes.dark.onPrimary = "#04305F"
# solara.lab.theme.themes.dark.secondary = "#BDC7DC"
# solara.lab.theme.themes.dark.onSecondary = "#273141"
# solara.lab.theme.themes.dark.accent = "#85D2E8"
# solara.lab.theme.themes.dark.onAccent = "#003641"
# solara.lab.theme.themes.dark.info = "#1d4ed8"
# solara.lab.theme.themes.dark.success = "#15803d"
# solara.lab.theme.themes.dark.warning = "#b45309"
# solara.lab.theme.themes.dark.error = "#b91c1c"

solara.lab.theme.themes.light.primary = "#2196f3"
solara.lab.theme.themes.light.secondary = "#ff5722"
solara.lab.theme.themes.light.accent = "#607d8b"
solara.lab.theme.themes.light.error = "#f44336"
solara.lab.theme.themes.light.warning = "#ffc107"
solara.lab.theme.themes.light.info = "#00bcd4"
solara.lab.theme.themes.light.success = "#8bc34a"

solara.lab.theme.themes.dark.primary = "#673ab7"
solara.lab.theme.themes.dark.secondary = "#ff5722"
solara.lab.theme.themes.dark.accent = "#cddc39"
solara.lab.theme.themes.dark.error = "#f44336"
solara.lab.theme.themes.dark.warning = "#ffc107"
solara.lab.theme.themes.dark.info = "#00bcd4"
solara.lab.theme.themes.dark.success = "#8bc34a"

0 comments on commit 729c334

Please sign in to comment.