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

Added background color for markers #4012

Merged
merged 3 commits into from
Dec 19, 2023
Merged

Conversation

vallsv
Copy link
Contributor

@vallsv vallsv commented Dec 18, 2023

Related to #4005 #4010

Previously an automatic background color was added to the marker text of the OpenGL backend to try to improve the readability of the text. That's unfortunately not enough, so better to let it open to the designer.

  • Now the background is used for both backend
  • And designer can specify it as marker.setBackgroundColor("red")
  • The automatic background was dropped
        label = Marker()
        label.setPosition(50, 50)
        label.setText("Foo bar\nmmmmmmmmmmmmmmmmmmmm")
        label.setBackgroundColor("#FFFFFF44")
        plot.addItem(label)

        label2 = Marker()
        label2.setPosition(70, 70)
        label2.setText("Foo bar")
        label2.setColor("red")
        label2.setBackgroundColor("#00000044")
        plot.addItem(label2)

        label3 = Marker()
        label3.setPosition(10, 70)
        label3.setText("Pioupiou")
        label3.setColor("yellow")
        label3.setBackgroundColor("#000000")
        plot.addItem(label3)

image

Changelog:

  • Markers now support a text background color
  • The automatic text marker background was dropped for the opengl backend

@vallsv vallsv requested a review from t20100 December 18, 2023 13:23
src/silx/gui/plot/backends/BackendBase.py Outdated Show resolved Hide resolved
src/silx/gui/plot/backends/BackendBase.py Outdated Show resolved Hide resolved
src/silx/gui/plot/backends/BackendMatplotlib.py Outdated Show resolved Hide resolved
src/silx/gui/plot/backends/BackendOpenGL.py Outdated Show resolved Hide resolved
src/silx/gui/plot/backends/BackendOpenGL.py Outdated Show resolved Hide resolved
src/silx/gui/plot/items/marker.py Outdated Show resolved Hide resolved
src/silx/gui/plot/items/marker.py Outdated Show resolved Hide resolved
src/silx/gui/plot/items/marker.py Outdated Show resolved Hide resolved
src/silx/gui/plot/backends/BackendOpenGL.py Show resolved Hide resolved
@vallsv
Copy link
Contributor Author

vallsv commented Dec 18, 2023

Here is fixes as requested.

@t20100 t20100 added this to the 2.0.0 milestone Dec 18, 2023
@t20100 t20100 merged commit ff756fc into silx-kit:main Dec 19, 2023
7 checks passed
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

Successfully merging this pull request may close these issues.

2 participants