Skip to content

Commit

Permalink
feat: dark theme for the solara.dev website
Browse files Browse the repository at this point in the history
Images and other resources still need to be updated
  • Loading branch information
iisakkirotko committed Feb 26, 2024
1 parent 69bca0d commit d540d84
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 16 deletions.
30 changes: 20 additions & 10 deletions solara/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,20 @@ def exception(self) -> Optional[Exception]:
return self._exception.value

@abc.abstractmethod
def retry(self) -> None: ...
def retry(self) -> None:
...

@abc.abstractmethod
def cancel(self) -> None: ...
def cancel(self) -> None:
...

@abc.abstractmethod
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> None: ...
def __call__(self, *args: P.args, **kwargs: P.kwargs) -> None:
...

@abc.abstractmethod
def is_current(self) -> bool: ...
def is_current(self) -> bool:
...

def _prestart(self):
self._result.value = TaskResult[R](latest=self._last_value, _state=TaskState.STARTING)
Expand Down Expand Up @@ -438,15 +442,17 @@ def task(
f: None = None,
*,
prefer_threaded: bool = ...,
) -> Callable[[Callable[P, R]], Task[P, R]]: ...
) -> Callable[[Callable[P, R]], Task[P, R]]:
...


@overload
def task(
f: Callable[P, Union[Coroutine[Any, Any, R], R]],
*,
prefer_threaded: bool = ...,
) -> Task[P, R]: ...
) -> Task[P, R]:
...


def task(
Expand Down Expand Up @@ -693,7 +699,8 @@ def use_task(
dependencies: None = ...,
raise_error=...,
prefer_threaded=...,
) -> Callable[[Callable[P, R]], Task[P, R]]: ...
) -> Callable[[Callable[P, R]], Task[P, R]]:
...


@overload
Expand All @@ -703,7 +710,8 @@ def use_task(
dependencies: None = ...,
raise_error=...,
prefer_threaded=...,
) -> Task[P, R]: ...
) -> Task[P, R]:
...


@overload
Expand All @@ -713,7 +721,8 @@ def use_task(
dependencies: List = ...,
raise_error=...,
prefer_threaded=...,
) -> Callable[[Callable[[], R]], "Task[[], R]"]: ...
) -> Callable[[Callable[[], R]], "Task[[], R]"]:
...


@overload
Expand All @@ -723,7 +732,8 @@ def use_task(
dependencies: List = ...,
raise_error=...,
prefer_threaded=...,
) -> "Task[[], R]": ...
) -> "Task[[], R]":
...


def use_task(
Expand Down
92 changes: 91 additions & 1 deletion solara/website/assets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,13 @@
--jp-content-font-size3: 1.75rem;
--jp-content-font-size4: 2rem;
--jp-content-font-size5: 2.25rem;

--dark-color-primary-lightest: #26273D;
--dark-color-primary: #ff991f;
--dark-color-primary-darker: #262D69;
--dark-color-text: hsla(0,0%,100%,.7);
--dark-color-grey: #ababab;
--dark-color-grey-light: #202020;
}

html,
Expand All @@ -29,6 +36,9 @@ li {
color: var(--color-text);
font-size: var(--font-size);
}
.theme--dark p, .theme--dark ul, .theme--dark li {
color: var(--dark-color-text);
}

a {
transition: color 0.3s ease;
Expand All @@ -38,6 +48,10 @@ a:link {
color: var(--color-primary);
}

.theme--dark a:link {
color: var(--dark-color-primary);
}

.jp-RenderedHTMLCommon pre {
background-color: var(--color-grey-light);
display: block;
Expand All @@ -46,6 +60,10 @@ a:link {
margin: 0.5rem 0;
}

.theme--dark .jp-RenderedHTMLCommon pre {
background-color: var(--dark-color-grey-light);
}

.code {
padding: 0;
margin: 0;
Expand All @@ -59,10 +77,18 @@ a:link {
background-color: var(--color-primary);
}

.theme--dark .bg-primary {
background-color: var(--dark-color-primary);
}

.bg-primary-fade {
background-color: var(--color-primary-lightest) !important;
}

.theme--dark .bg-primary-fade {
background-color: var(--dark-color-primary-lightest) !important;
}

.padding-40 {
padding: 40px !important;
}
Expand All @@ -75,12 +101,20 @@ h1 {
background-color: var(--color-grey-light);
}

.theme--dark .bg-grey {
background-color: var(--dark-color-grey-light);
}

li::marker {
color: var(--color-primary);
font-size: 1.2em;
font-weight: bold;
}

.theme--dark li::marker {
color: var(--dark-color-primary);
}

blockquote,
.jp-RenderedHTMLCommon blockquote {
font-family: "Courier New", Courier, monospace;
Expand All @@ -94,6 +128,12 @@ blockquote,
background-position: 1.2rem center;
}

.theme--dark blockquote,
.theme--dark .jp-RenderedHTMLCommon blockquote {
border-left: 8px solid var(--dark-color-primary);
background-color: var(--dark-color-grey-light);
}

blockquote p:last-child {
margin-bottom: 0;
}
Expand All @@ -113,6 +153,25 @@ blockquote p:last-child {
max-width: 500px;
}

.v-btn.homepage-button {
background-color: var(--color-primary-darker) !important;
}

.theme--dark .v-btn.homepage-button {
background-color: var(--dark-color-primary-darker) !important;
}

.v-card.testimonial-card{
background-color: var(--color-primary-lightest);
display: flex;
flex-direction: column;
justify-content: space-between;
}

.theme--dark .v-card.testimonial-card{
background-color: var(--dark-color-primary-lightest);
}

/* vuetify component overrides */

.v-btn.solara-docs-button {
Expand All @@ -131,6 +190,10 @@ blockquote p:last-child {
color: var(--color-primary-darker) !important;
}

.theme--dark.v-application .text--primary {
color: var(--dark-color-primary-darker) !important;
}

/* hero */
.hero {
background: var(--color-primary-lightest) url(https://dxhl76zpt6fap.cloudfront.net/public/hero.webp);
Expand All @@ -139,6 +202,11 @@ blockquote p:last-child {
padding: 7rem 0;
}

.theme--dark .hero {
background: var(--dark-color-primary-lightest) url(https://dxhl76zpt6fap.cloudfront.net/public/hero.webp);
background-size: cover;
}

.hero h1 {
font-size: 4.5rem;
}
Expand All @@ -149,7 +217,11 @@ blockquote p:last-child {
}

.hero b {
color: #ff991f;
color: var(--color-primary);
}

.theme--dark .hero b {
color: var(--dark-color-primary);
}

@media screen and (max-width: 960px) {
Expand Down Expand Up @@ -180,10 +252,19 @@ blockquote p:last-child {
color: var(--color-grey);
}

.theme--dark .menu li a:link,
.theme--dark .menu li a:visited {
color: var(--dark-color-grey);
}

.menu li a:hover {
color: var(--color-primary);
}

.theme--dark .menu li a:hover {
color: var(--dark-color-primary);
}

.menu li a:link {
display: block;
padding: 1rem 2rem;
Expand Down Expand Up @@ -214,11 +295,20 @@ blockquote p:last-child {
color: var(--color-grey);
}

.theme--dark .sidebar a:link,
.theme--dark .sidebar a:visited {
color: var(--dark-color-grey);
}

.sidebar a:hover {
color: var(--color-primary);
text-decoration: none;
}

.theme--dark .sidebar a:hover {
color: var(--dark-color-primary);
}

.sidebar ul li {
font-weight: normal;
margin: 0.8rem auto;
Expand Down
3 changes: 3 additions & 0 deletions solara/website/assets/theme.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
vuetifyThemes = {
light: {
primary: '#ff991f',
},
dark: {
primary: '#ff991f',
}
}
5 changes: 4 additions & 1 deletion solara/website/components/header.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ def Header(
solara.Style(
"""
.news {
background-color: #ff991f;
background-color: var(--color-primary);
padding: 10px;
font-size: 20px;
display: flex;
justify-content: center;
}
.theme--dark .news {
background-color: var(--dark-color-primary-darker);
}
.news a {
color: white !important;
}
Expand Down
7 changes: 3 additions & 4 deletions solara/website/pages/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ def Layout(children=[]):
)
with solara.HBox():
with solara.Link("/docs"):
solara.Button(label="Read more", class_="ma-1", href="/docs", color="#f19f41", dark=True)
solara.Button(label="Read more", class_="ma-1 homepage-button", href="/docs", color="primary", dark=True)
with solara.Link("/docs/quickstart"):
solara.Button(label="Quickstart", class_="ma-1", color="#f19f41", dark=True)
solara.Button(label="Quickstart", class_="ma-1 homepage-button", color="primary", dark=True)
# with rv.Col(md=4, sm=5):
# rv.Img(src="https://dxhl76zpt6fap.cloudfront.net/public/landing/what.webp", style_="width:900px")

Expand Down Expand Up @@ -341,9 +341,8 @@ def Testimonial(text, name, position, img):
with rv.Card(
elevation=2,
dark=False,
color="#ffeec5",
max_width=max_width,
style_="display: flex; flex-direction: column; justify-content: space-between;",
class_="testimonial-card",
):
# rv.CardTitle(children=["Former Plotly CEO"])
with rv.CardActions():
Expand Down

0 comments on commit d540d84

Please sign in to comment.