Skip to content

Conversation

paololazzari
Copy link
Contributor

Fixes #1949.

I tested this locally by adding the following to testing/local-binder-mocked-hub/binderhub_config.py:

c.BinderHub.banner_message = 'This is headline <a href="#">news.</a>'
c.BinderHub.extra_css = """
.p-3.bg-light.shadow-sm.text-center {
    color: red;
}
"""

the style was loaded and the headline color changed.

Copy link
Contributor

@rgaiacs rgaiacs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good to me. Before merge, can we

  • use if-clause in the HTML template
  • document it for the Helm chart

@paololazzari
Copy link
Contributor Author

@rgaiacs Thanks! Where should I document this for the helm chart?

@rgaiacs
Copy link
Contributor

rgaiacs commented Mar 13, 2025

Where should I document this for the helm chart?

I believe that the traitlets are "magic" connected to the helm chart. But it is nice to add to

config:
# These c.BinderHub properties are referenced by the Helm chart
BinderHub:
# auth_enabled:
base_url: /
build_node_selector: {}
# hub_url:
# hub_url_local:
use_registry: true
KubernetesBuildExecutor: {}
like

config:
  # These c.BinderHub properties are referenced by the Helm chart
  BinderHub:
    ...
    # extra_css: |
    #  .p-3.bg-light.shadow-sm.text-center {
    #      color: red;
    #  }

Also mention it in the documentation

I would like to merge #1923 before this one.

@paololazzari
Copy link
Contributor Author

@rgaiacs I did think about documenting extra_css in those two files, but I did not do it because I found that extra_footer_scripts was not documented there. I assumed whatever reasoning was behind not documenting extra_footer_scripts would hold true in this case too.

@rgaiacs
Copy link
Contributor

rgaiacs commented Mar 28, 2025

Hi @paololazzari, thanks again for the PR. I noticed that this PR will only work in some scenarios. To enable custom CSS as CSS was originally design for, we also need #1952.

The scenario that the solution that you proposed will not work is when you try to change some style from https://github.com/jupyterhub/binderhub/blob/main/binderhub/static/js/index.scss. For example, I was trying to change the font used in the page but using your solution resulted in

grafik

@paololazzari
Copy link
Contributor Author

My proposal was to add CSS, not replace the existing one

@rgaiacs
Copy link
Contributor

rgaiacs commented Sep 9, 2025

Sorry @paololazzari for the delay to return to your pull request. #2012 created a minor conflict with this pull request. I checked and the conflict resolution is to accept both changes. Do you want to resolve the conflict or should I do it?

@paololazzari
Copy link
Contributor Author

@rgaiacs Happy for you to do it

@rgaiacs rgaiacs self-assigned this Oct 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Provide way to inject custom css in page

2 participants