Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom css at runtime #1224

Closed
Fajfa opened this issue May 24, 2023 · 6 comments · Fixed by #1262
Closed

Allow custom css at runtime #1224

Fajfa opened this issue May 24, 2023 · 6 comments · Fixed by #1262
Assignees
Labels
backend Backend server changes (GO) critical frontend Frontend code changes (Javascript, Typescript, Vue.js)
Milestone

Comments

@Fajfa
Copy link
Member

Fajfa commented May 24, 2023

First iteration:

  • BE Generates css which we always include in the head
  • FE Textarea in Admin/UI
  • Add ids to base divs for each web app to allow app-specific selectors

SCSS support should be added if needed and in next versions

@Fajfa Fajfa added backend Backend server changes (GO) frontend Frontend code changes (Javascript, Typescript, Vue.js) labels May 24, 2023
@Fajfa Fajfa added this to the 2023.3.3 milestone May 24, 2023
@skamensky
Copy link
Contributor

What about custom js?

There's a hack that can be used as a workaround but it'd be really cool to see official support for this!

@Fajfa
Copy link
Member Author

Fajfa commented May 24, 2023

Feel free to create a new issue, but it's not really planned at the moment

@skamensky
Copy link
Contributor

There's already an older discussion open for it (which is where you're directed to when you click on "Ideas, enhancements and feature requests 🚀")

Should I turn this into an isssue instead?

@Fajfa
Copy link
Member Author

Fajfa commented May 24, 2023

Feel free, mark it as an enhancement please

@skamensky
Copy link
Contributor

I don't have permisssions to add labels, but feel free to :-)

#1226

@Fajfa Fajfa assigned vicpatel and unassigned tjerman May 25, 2023
@Fajfa Fajfa assigned KinyaElGrande and unassigned vicpatel Jun 1, 2023
@Fajfa Fajfa removed their assignment Jun 13, 2023
@KinyaElGrande KinyaElGrande linked a pull request Jun 16, 2023 that will close this issue
@tjerman tjerman self-assigned this Jun 16, 2023
@Fajfa Fajfa added the critical label Jun 20, 2023
@KinyaElGrande
Copy link
Contributor

The PR for enabling Custom CSS at runtime has been merged (ref: #1262).
For those looking to create a dark theme, here's an example of CSS configurations that can be utilized (still hacky):

:root {
    --body-bg: #092B40;
    --body-color: #FFFFFF;
    --white:         #FAF6F3;
    --black:         #0B344E;
    --primary:       #FF9661;
    --secondary:     #23495F;
    --success:       #43AA8B;
    --warning:       #E2A046;
    --danger:        #E54122;
    --light:         #567F92;
    --extra-light:   #162425;
    --dark:          #0B344E;
}

:root .btn-primary {
    background-color: var(--primary);
    border-color: var(--primary);
}

:root .bg-white {
    background-color: var(--black) !important;
}

:root .bg-light {
    background-color: var(--light) !important;
}

:root body {
    color: var(--body-color);
    background-color: var(--body-bg);
}

:root .text-dark {
    color: var(--white) !important;
}

:root .header-navigation {
    background-color: var(--black) !important;
}

:root .card {
    background-color: var(--dark);
}

:root .card-header {
    border-bottom: 1px solid #284C63;
}

:root .btn-link {
    color: var(--white);
}

Feel free to explore and experiment with different CSS properties and values to achieve your desired theme.

To target a specific webapp, you can utilize the following ID selectors:

  • #admin for the Admin web app
  • #compose for the Compose web app
  • #discovery for the Discovery web app
  • #one for the One web app
  • #privacy for the Privacy web app
  • #reporter for the Reporter web app
  • #workflow for the Workflow web app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend server changes (GO) critical frontend Frontend code changes (Javascript, Typescript, Vue.js)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants