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

Make superset-logo-horiz.png bigger #30933

Open
acolgecen opened this issue Nov 15, 2024 · 3 comments
Open

Make superset-logo-horiz.png bigger #30933

acolgecen opened this issue Nov 15, 2024 · 3 comments

Comments

@acolgecen
Copy link

I would like to enlarge the superset-logo-horiz.png logo on the Superset UI's frontend.
I understand that the superset_config.py file does not recognize CUSTOM_CSS = "/static/assets/".

Does anyone know the correct way to achieve this?

Copy link

dosubot bot commented Nov 15, 2024

To enlarge the superset-logo-horiz.png logo in the Superset UI, you can use custom CSS. Here's how you can achieve this:

  1. Inject Custom CSS: Use the injectCustomCss function to apply your custom styles. This function allows you to add CSS directly to the document's head.
import injectCustomCss from 'path/to/injectCustomCss';

const customCss = `
  /* Example CSS to enlarge the logo */
  .navbar-brand img {
    width: 200px; /* Adjust the width as needed */
    height: auto; /* Maintain aspect ratio */
  }
`;

const removeCustomCSS = injectCustomCss(customCss);

// Call removeCustomCSS() if you need to remove the custom styles later
  1. CSS Templates: Alternatively, you can create a CSS template using the CssTemplate model in Superset. This allows you to manage and apply styles across the application consistently.

By using these methods, you can customize the size of the logo without modifying the core Superset files.

To continue talking to Dosu, mention @dosu.

@acolgecen
Copy link
Author

@dosu I dont have InjectCustomCss because I have installed superset with pip install apache-superset and not with superset git repository. So how I do that with pip installed superset.

Copy link

dosubot bot commented Nov 18, 2024

In a pip-installed Superset environment, you can still apply custom CSS by using the CssTemplate model to manage and apply styles. Here's how you can do it:

  1. Create a CSS Template: You can define a CSS template in Python and load it into the Superset database. This allows you to apply custom styles across the application.

  2. Example CSS Template: You can create a Python script to add your custom CSS to the database. Here's a basic example:

from superset import db
from superset.models.core import CssTemplate

# Define your custom CSS
custom_css = """
.navbar-brand img {
    width: 200px; /* Adjust the width as needed */
    height: auto; /* Maintain aspect ratio */
}
"""

# Create a new CSS template
css_template = CssTemplate(
    template_name='Custom Logo Size',
    css=custom_css
)

# Add the template to the database
db.session.add(css_template)
db.session.commit()
  1. Apply the CSS Template: Once the template is added to the database, you can apply it through the Superset UI by selecting it in the appropriate settings or dashboard configuration.

This approach allows you to manage your custom styles without needing direct access to the frontend codebase.

To continue talking to Dosu, mention @dosu.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant