Coder Social home page Coder Social logo

[FEATURE] Coloring of active tabs about bokeh HOT 1 CLOSED

dinya avatar dinya commented on May 25, 2024
[FEATURE] Coloring of active tabs

from bokeh.

Comments (1)

dinya avatar dinya commented on May 25, 2024

After thinking it over, it seemed like a special case. Closed the issue.

I'll leave it here as a recipe

from bokeh.models import Div, TabPanel, Tabs
from bokeh.plotting import show
from bokeh.layouts import layout

level0 = [1, 2]
level1 = [1, 2, 3]
level2 = [1, 2, 3, 4]

label = "Lorem ipsum" 

stylesheet = """
:host(.bk-Tabs) .bk-header {{
  border-bottom: 1px solid {tabcolor};
  .bk-active {{
    color: {tabcolor};
    border-color: {tabcolor};
    background-color: lightgray;
  }}
}}
"""

tabs0 = list()
for l0 in level0:
    tabs1 = list()
    for l1 in level1:
        tabs2 = list()
        for l2 in level2:
            tabs2.append(TabPanel(child=Div(text='Lorem ipsum'),
                                  title=f"{l0}.{l1}.{l2} {label} at level 2"))
        tabs1.append(TabPanel(child=Tabs(tabs=tabs2, stylesheets=[stylesheet.format(**dict(tabcolor="green"))]),
                              title=f"{l0}.{l1} {label} at level 1"))
    tabs0.append(TabPanel(child=Tabs(tabs=tabs1, stylesheets=[stylesheet.format(**dict(tabcolor="blue"))]),
                          title=f"{l0} {label} at level 0"))

show(Tabs(tabs=tabs0, stylesheets=[stylesheet.format(**dict(tabcolor="red"))]))

short-labeled-tabs-colored-done

from bokeh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.