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

Theming #24

Closed
miralemd opened this issue May 13, 2019 · 0 comments
Closed

Theming #24

miralemd opened this issue May 13, 2019 · 0 comments
Labels
api-stardust JavaScript library for building mashups

Comments

@miralemd
Copy link
Contributor

Motivation

White labeling and customizing the look and feel is an important aspect of integration for mashups.

Concerns

  • Modifying styles by directly referencing CSS classes isn't ideal as various integrations could easily interfere with eachother.
  • Supporting different versions of nebula (which could have different styles in different versions) in the same page would also be a risk of clashing styles.
  • Applying a different style per chart on the same page should also be possible.
  • UI and visualizations should be broken down into components, the theme is defined on component level, not on chart level.

Solution

For those reasons we will be taking a CSS-in-JS approach as it will minimize the above risks.

The definition of a theme might look like this:

{
  typography: {
    fontFamily: '"Source Sans Pro", Arial, sans-serif',
    fontSize: '14px',
  },
  palette: {
    primary: 'green',
    secondary: 'purple',
    background: '#fafafa',
    surface: '#ffffff',
    text: {
      primary: '#404040',
      secondary: '#999',
    }
  },
  shape: {
    borderRadius: 4
  },
  data: {
    nil: '#eee',
    categorical: ['red', 'green', 'blue'],
  },
}

Themes are used per app and nucleus instance:

const nebbie = nebula(enigmaApp).theme({ typeography: { fontFamily: 'Georgia' }});

// all charts created from the same nucleus instance will have the same theme
nebbie.get({ id: 'fgdtr' }, { element });
nebbie.get({ id: 'fs4fr' }, { element });

// it should be possible to apply a different theme to a different instance on the same page
const nebbie2 = nebula(enigmaApp).theme({ typeography: { fontFamily: 'Monaco' }});
nebbie.get2({ id: 'adfs3' }, { element });
nebbie.get({ id: 'bcnhj' }, { element });
@miralemd miralemd added the api-stardust JavaScript library for building mashups label May 13, 2019
This was referenced May 13, 2019
@Caele Caele closed this as completed Dec 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-stardust JavaScript library for building mashups
Projects
None yet
Development

No branches or pull requests

2 participants