def set_yellow():
    style = bimpy.get_style()

    # style.set_color(bimpy.Colors.Text, bimpy.Vec4(0.31, 0.25, 0.24, 1.00))
    # style.set_color(bimpy.Colors.WindowBg, bimpy.Vec4(0.94, 0.94, 0.94, 1.00))
    #
    # style.set_color(bimpy.Colors.ChildWindowBg, bimpy.Vec4(0.00, 0.00, 0.00, 0.00))
    # style.set_color(bimpy.Colors.Border, bimpy.Vec4(0.00, 0.00, 0.00, 0.39))
    # style.set_color(bimpy.Colors.BorderShadow, bimpy.Vec4(1.00, 1.00, 1.00, 0.10))
    # style.set_color(bimpy.Colors.FrameBg, bimpy.Vec4(1.00, 1.00, 1.00, 1.00))
    # style.set_color(bimpy.Colors.FrameBgHovered, bimpy.Vec4(0.26, 0.59, 0.98, 0.40))
    # style.set_color(bimpy.Colors.FrameBgActive, bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    # style.set_color(bimpy.Colors.TitleBg, bimpy.Vec4(0.96, 0.96, 0.96, 1.00))
    # style.set_color(bimpy.Colors.TitleBgCollapsed, bimpy.Vec4(1.00, 1.00, 1.00, 0.51))
    # style.set_color(bimpy.Colors.TitleBgActive, bimpy.Vec4(0.82, 0.82, 0.82, 1.00))
    # style.set_color(bimpy.Colors.MenuBarBg, bimpy.Vec4(0.86, 0.86, 0.86, 1.00))
    # style.set_color(bimpy.Colors.ScrollbarBg, bimpy.Vec4(0.98, 0.98, 0.98, 0.53))
    # style.set_color(bimpy.Colors.ScrollbarGrab, bimpy.Vec4(0.69, 0.69, 0.69, 0.80))
    # style.set_color(bimpy.Colors.ScrollbarGrabHovered, bimpy.Vec4(0.49, 0.49, 0.49, 0.80))
    # style.set_color(bimpy.Colors.ScrollbarGrabActive, bimpy.Vec4(0.49, 0.49, 0.49, 1.00))
    # # style.set_color(bimpy.Colors.ComboBg, bimpy.Vec4(0.86, 0.86, 0.86, 0.99))
    # style.set_color(bimpy.Colors.CheckMark, bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    # style.set_color(bimpy.Colors.SliderGrab, bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    # style.set_color(bimpy.Colors.SliderGrabActive, bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.Button, bimpy.Vec4(1.00, 0.79, 0.18, 0.78))
    style.set_color(bimpy.Colors.ButtonHovered,
                    bimpy.Vec4(0.42, 0.82, 1.00, 0.81))
    style.set_color(bimpy.Colors.ButtonActive,
                    bimpy.Vec4(0.72, 1.00, 1.00, 0.86))

    style.set_color(bimpy.Colors.Header, bimpy.Vec4(0.65, 0.78, 0.84, 0.80))
    style.set_color(bimpy.Colors.HeaderHovered,
                    bimpy.Vec4(0.75, 0.88, 0.94, 0.80))
    style.set_color(bimpy.Colors.HeaderActive,
                    bimpy.Vec4(0.55, 0.68, 0.74, 0.80))

    # style.set_color(bimpy.Colors.Column, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    # style.set_color(bimpy.Colors.ColumnHovered, bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    # style.set_color(bimpy.Colors.ColumnActive, bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    # style.set_color(bimpy.Colors.ResizeGrip, bimpy.Vec4(0.50, 0.50, 0.50, 1.00))
    # style.set_color(bimpy.Colors.ResizeGripHovered, bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    # style.set_color(bimpy.Colors.ResizeGripActive, bimpy.Vec4(0.26, 0.59, 0.98, 0.95))
    # # style.set_color(bimpy.Colors.CloseButton, bimpy.Vec4(0.59, 0.59, 0.59, 0.50))
    # # style.set_color(bimpy.Colors.CloseButtonHovered, bimpy.Vec4(0.98, 0.39, 0.36, 1.00))
    # # style.set_color(bimpy.Colors.CloseButtonActive, bimpy.Vec4(0.98, 0.39, 0.36, 1.00))
    # style.set_color(bimpy.Colors.PlotLines, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    # style.set_color(bimpy.Colors.PlotLinesHovered, bimpy.Vec4(1.00, 0.43, 0.35, 1.00))
    # style.set_color(bimpy.Colors.PlotHistogram, bimpy.Vec4(0.90, 0.70, 0.00, 1.00))
    # style.set_color(bimpy.Colors.PlotHistogramHovered, bimpy.Vec4(1.00, 0.60, 0.00, 1.00))
    # style.set_color(bimpy.Colors.TextSelectedBg, bimpy.Vec4(0.26, 0.59, 0.98, 0.35))
    # style.set_color(bimpy.Colors.PopupBg, bimpy.Vec4(1.00, 1.00, 1.00, 0.94))
    # style.set_color(bimpy.Colors.ModalWindowDarkening, bimpy.Vec4(0.20, 0.20, 0.20, 0.35))

    style.alpha = 1.0
    style.indent_spacing = 12.0

    bimpy.set_style(style)
示例#2
0
文件: themes.py 项目: zakx/bimpy
def set_light_theme():
    """ light style from Pacome Danhiez (user itamago) https://github.com/ocornut/imgui/pull/511#issuecomment-175719267 """

    style = bimpy.get_style()
    style.set_color(bimpy.Colors.Text, bimpy.Vec4(0.00, 0.00, 0.00, 1.00))
    style.set_color(bimpy.Colors.TextDisabled,
                    bimpy.Vec4(0.60, 0.60, 0.60, 1.00))
    style.set_color(bimpy.Colors.WindowBg, bimpy.Vec4(0.94, 0.94, 0.94, 1.00))
    style.set_color(bimpy.Colors.ChildWindowBg,
                    bimpy.Vec4(0.00, 0.00, 0.00, 0.00))
    style.set_color(bimpy.Colors.Border, bimpy.Vec4(0.00, 0.00, 0.00, 0.39))
    style.set_color(bimpy.Colors.BorderShadow,
                    bimpy.Vec4(1.00, 1.00, 1.00, 0.10))
    style.set_color(bimpy.Colors.FrameBg, bimpy.Vec4(1.00, 1.00, 1.00, 1.00))
    style.set_color(bimpy.Colors.FrameBgHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.40))
    style.set_color(bimpy.Colors.FrameBgActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    style.set_color(bimpy.Colors.TitleBg, bimpy.Vec4(0.96, 0.96, 0.96, 1.00))
    style.set_color(bimpy.Colors.TitleBgCollapsed,
                    bimpy.Vec4(1.00, 1.00, 1.00, 0.51))
    style.set_color(bimpy.Colors.TitleBgActive,
                    bimpy.Vec4(0.82, 0.82, 0.82, 1.00))
    style.set_color(bimpy.Colors.MenuBarBg, bimpy.Vec4(0.86, 0.86, 0.86, 1.00))
    style.set_color(bimpy.Colors.ScrollbarBg,
                    bimpy.Vec4(0.98, 0.98, 0.98, 0.53))
    style.set_color(bimpy.Colors.ScrollbarGrab,
                    bimpy.Vec4(0.69, 0.69, 0.69, 0.80))
    style.set_color(bimpy.Colors.ScrollbarGrabHovered,
                    bimpy.Vec4(0.49, 0.49, 0.49, 0.80))
    style.set_color(bimpy.Colors.ScrollbarGrabActive,
                    bimpy.Vec4(0.49, 0.49, 0.49, 1.00))
    # style.set_color(bimpy.Colors.ComboBg, bimpy.Vec4(0.86, 0.86, 0.86, 0.99))
    style.set_color(bimpy.Colors.CheckMark, bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.SliderGrab,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    style.set_color(bimpy.Colors.SliderGrabActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.Button, bimpy.Vec4(0.26, 0.59, 0.98, 0.40))
    style.set_color(bimpy.Colors.ButtonHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.ButtonActive,
                    bimpy.Vec4(0.06, 0.53, 0.98, 1.00))
    style.set_color(bimpy.Colors.Header, bimpy.Vec4(0.26, 0.59, 0.98, 0.31))
    style.set_color(bimpy.Colors.HeaderHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.80))
    style.set_color(bimpy.Colors.HeaderActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.Column, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    style.set_color(bimpy.Colors.ColumnHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    style.set_color(bimpy.Colors.ColumnActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.ResizeGrip,
                    bimpy.Vec4(0.50, 0.50, 0.50, 1.00))
    style.set_color(bimpy.Colors.ResizeGripHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    style.set_color(bimpy.Colors.ResizeGripActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.95))
    # style.set_color(bimpy.Colors.CloseButton, bimpy.Vec4(0.59, 0.59, 0.59, 0.50))
    # style.set_color(bimpy.Colors.CloseButtonHovered, bimpy.Vec4(0.98, 0.39, 0.36, 1.00))
    # style.set_color(bimpy.Colors.CloseButtonActive, bimpy.Vec4(0.98, 0.39, 0.36, 1.00))
    style.set_color(bimpy.Colors.PlotLines, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    style.set_color(bimpy.Colors.PlotLinesHovered,
                    bimpy.Vec4(1.00, 0.43, 0.35, 1.00))
    style.set_color(bimpy.Colors.PlotHistogram,
                    bimpy.Vec4(0.90, 0.70, 0.00, 1.00))
    style.set_color(bimpy.Colors.PlotHistogramHovered,
                    bimpy.Vec4(1.00, 0.60, 0.00, 1.00))
    style.set_color(bimpy.Colors.TextSelectedBg,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.35))
    style.set_color(bimpy.Colors.PopupBg, bimpy.Vec4(1.00, 1.00, 1.00, 0.94))
    style.set_color(bimpy.Colors.ModalWindowDarkening,
                    bimpy.Vec4(0.20, 0.20, 0.20, 0.35))
    bimpy.set_style(style)
示例#3
0
def show_demo_window():
    bp.begin_root(menu=True)

    #  Menu Bar
    if bp.begin_menu_bar():
        if bp.begin_menu("Menu"):
            bp.end_menu()

        if bp.begin_menu("Examples"):
            bp.end_menu()

        if bp.begin_menu("Tools"):
            bp.end_menu()

        bp.end_menu_bar()

    global clicked
    if bp.button("Button"):
        clicked += 1
    if clicked & 1:
        bp.same_line()
        bp.text("Thanks for clicking me!")

    bp.checkbox("checkbox", check)

    bp.radio_button("radio a", e, 0)
    bp.same_line()
    bp.radio_button("radio b", e, 1)
    bp.same_line()
    bp.radio_button("radio c", e, 2)

    #  Color buttons, demonstrate using PushID() to add unique identifier in the ID stack, and changing style.
    for i in range(7):
        if i > 0:
            bp.same_line()
        bp.push_id_int(i)
        bp.push_style_color(bp.Colors.Button, bp.Vec4(i / 7.0, 0.6, 0.6, 1.0))
        bp.push_style_color(bp.Colors.ButtonHovered,
                            bp.Vec4(i / 7.0, 0.7, 0.7, 1.0))
        bp.push_style_color(bp.Colors.ButtonActive,
                            bp.Vec4(i / 7.0, 0.8, 0.8, 1.0))
        bp.button("Click")
        bp.pop_style_color(3)
        bp.pop_id()

    #  Use AlignTextToFramePadding() to align text baseline to the baseline of framed elements (otherwise a Text+SameLine+Button sequence will have the text a little too high by default)
    bp.align_text_to_frame_padding()
    bp.text("Hold to repeat:")
    bp.same_line()

    #  Arrow buttons with Repeater
    spacing = bp.get_style().item_inner_spacing.x
    bp.push_button_repeat(True)

    global counter
    if bp.arrow_button("##left", bp.Direction.Left):
        counter -= 1

    bp.same_line(0.0, spacing)
    if bp.arrow_button("##right", bp.Direction.Right):
        counter += 1

    bp.pop_button_repeat()
    bp.same_line()
    bp.text("%d" % counter)

    bp.text("Hover over me")
    if bp.is_item_hovered():
        bp.set_tooltip("I am a tooltip")

    bp.same_line()
    bp.text("- or me")
    if bp.is_item_hovered():
        bp.begin_tooltip()
        bp.text("I am a fancy tooltip")
        arr = [0.6, 0.1, 1.0, 0.5, 0.92, 0.1, 0.2]
        bp.plot_lines("Curve", arr)
        bp.end_tooltip()

    bp.separator()

    bp.label_text("label", "Value")

    #  Using the _simplified_ one-liner Combo() api here
    #  See "Combo" section for examples of how to use the more complete BeginCombo()/EndCombo() api.
    items = [
        "AAAA", "BBBB", "CCCC", "DDDD", "EEEE", "FFFF", "GGGG", "HHHH", "IIII",
        "JJJJ", "KKKK", "LLLLLLL", "MMMM", "OOOOOOO"
    ]
    bp.combo("combo", item_current, items)
    bp.same_line()
    help_marker(
        "Refer to the \"Combo\" section below for an explanation of the full BeginCombo/EndCombo API, and demonstration of various flags.\n"
    )

    #  To wire InputText() with std::string or any other custom string type,
    #  see the "Text Input > Resize Callback" section of this demo, and the misc/cpp/imgui_stdlib.h file.
    bp.input_text("input text", str0, 128)
    bp.same_line()
    help_marker(
        "USER:\nHold SHIFT or use mouse to select text.\n"
        "CTRL+Left/Right to word jump.\n"
        "CTRL+A or double-click to select all.\n"
        "CTRL+X,CTRL+C,CTRL+V clipboard.\n"
        "CTRL+Z,CTRL+Y undo/redo.\n"
        "ESCAPE to revert.\n\nPROGRAMMER:\nYou can use the ImGuiInputTextFlags_CallbackResize facility if you need to wire InputText() to a dynamic string type. See misc/cpp/imgui_stdlib.h for an example (this is not demonstrated in imgui_demo.cpp)."
    )

    bp.end()
示例#4
0
def set_light_theme():
    """ light style from Pacome Danhiez (user itamago) https://github.com/ocornut/imgui/pull/511#issuecomment-175719267 """

    style = bimpy.get_style()
    style.set_color(bimpy.Colors.Text, bimpy.Vec4(0.00, 0.00, 0.00, 1.00))
    style.set_color(bimpy.Colors.TextDisabled,
                    bimpy.Vec4(0.60, 0.60, 0.60, 1.00))
    style.set_color(bimpy.Colors.WindowBg, bimpy.Vec4(0.94, 0.94, 0.94, 1.00))
    style.set_color(bimpy.Colors.ChildBg, bimpy.Vec4(0.00, 0.00, 0.00, 0.00))
    style.set_color(bimpy.Colors.PopupBg, bimpy.Vec4(1.00, 1.00, 1.00, 0.98))
    style.set_color(bimpy.Colors.Border, bimpy.Vec4(0.00, 0.00, 0.00, 0.39))
    style.set_color(bimpy.Colors.BorderShadow,
                    bimpy.Vec4(1.00, 1.00, 1.00, 0.10))
    style.set_color(bimpy.Colors.FrameBg, bimpy.Vec4(1.00, 1.00, 1.00, 1.00))
    style.set_color(bimpy.Colors.FrameBgHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.40))
    style.set_color(bimpy.Colors.FrameBgActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    style.set_color(bimpy.Colors.TitleBg, bimpy.Vec4(0.96, 0.96, 0.96, 1.00))
    style.set_color(bimpy.Colors.TitleBgCollapsed,
                    bimpy.Vec4(1.00, 1.00, 1.00, 0.51))
    style.set_color(bimpy.Colors.TitleBgActive,
                    bimpy.Vec4(0.82, 0.82, 0.82, 1.00))
    style.set_color(bimpy.Colors.MenuBarBg, bimpy.Vec4(0.86, 0.86, 0.86, 1.00))
    style.set_color(bimpy.Colors.ScrollbarBg,
                    bimpy.Vec4(0.98, 0.98, 0.98, 0.53))
    style.set_color(bimpy.Colors.ScrollbarGrab,
                    bimpy.Vec4(0.69, 0.69, 0.69, 0.80))
    style.set_color(bimpy.Colors.ScrollbarGrabHovered,
                    bimpy.Vec4(0.49, 0.49, 0.49, 0.80))
    style.set_color(bimpy.Colors.ScrollbarGrabActive,
                    bimpy.Vec4(0.49, 0.49, 0.49, 1.00))
    style.set_color(bimpy.Colors.CheckMark, bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.SliderGrab,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    style.set_color(bimpy.Colors.SliderGrabActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.Button, bimpy.Vec4(0.26, 0.59, 0.98, 0.40))
    style.set_color(bimpy.Colors.ButtonHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.ButtonActive,
                    bimpy.Vec4(0.06, 0.53, 0.98, 1.00))
    style.set_color(bimpy.Colors.Header, bimpy.Vec4(0.26, 0.59, 0.98, 0.31))
    style.set_color(bimpy.Colors.HeaderHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.80))
    style.set_color(bimpy.Colors.HeaderActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.Separator, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    style.set_color(bimpy.Colors.SeparatorHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.78))
    style.set_color(bimpy.Colors.SeparatorActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 1.00))
    style.set_color(bimpy.Colors.ResizeGrip,
                    bimpy.Vec4(0.50, 0.50, 0.50, 1.00))
    style.set_color(bimpy.Colors.ResizeGripHovered,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.67))
    style.set_color(bimpy.Colors.ResizeGripActive,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.95))
    style.set_color(
        bimpy.Colors.Tab,
        __lerp(style.get_color(bimpy.Colors.Header),
               style.get_color(bimpy.Colors.TitleBgActive), 0.90))
    style.set_color(bimpy.Colors.TabHovered,
                    style.get_color(bimpy.Colors.HeaderHovered))
    style.set_color(
        bimpy.Colors.TabActive,
        __lerp(style.get_color(bimpy.Colors.HeaderActive),
               style.get_color(bimpy.Colors.TitleBgActive), 0.60))
    style.set_color(
        bimpy.Colors.TabUnfocused,
        __lerp(style.get_color(bimpy.Colors.Tab),
               style.get_color(bimpy.Colors.TitleBg), 0.80))
    style.set_color(
        bimpy.Colors.TabUnfocusedActive,
        __lerp(style.get_color(bimpy.Colors.TabActive),
               style.get_color(bimpy.Colors.TitleBg), 0.40))
    style.set_color(bimpy.Colors.PlotLines, bimpy.Vec4(0.39, 0.39, 0.39, 1.00))
    style.set_color(bimpy.Colors.PlotLinesHovered,
                    bimpy.Vec4(1.00, 0.43, 0.35, 1.00))
    style.set_color(bimpy.Colors.PlotHistogram,
                    bimpy.Vec4(0.90, 0.70, 0.00, 1.00))
    style.set_color(bimpy.Colors.PlotHistogramHovered,
                    bimpy.Vec4(1.00, 0.60, 0.00, 1.00))
    style.set_color(bimpy.Colors.TextSelectedBg,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.35))
    style.set_color(bimpy.Colors.DragDropTarget,
                    bimpy.Vec4(0.26, 0.59, 0.98, 0.95))
    style.set_color(bimpy.Colors.NavHighlight,
                    style.get_color(bimpy.Colors.HeaderHovered))
    style.set_color(bimpy.Colors.NavWindowingHighlight,
                    bimpy.Vec4(0.70, 0.70, 0.70, 0.70))
    style.set_color(bimpy.Colors.NavWindowingDimBg,
                    bimpy.Vec4(0.20, 0.20, 0.20, 0.20))
    style.set_color(bimpy.Colors.ModalWindowDimBg,
                    bimpy.Vec4(0.20, 0.20, 0.20, 0.35))
    bimpy.set_style(style)