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

Text in scale bar is not adopting to dark mode #967

Open
saratchandrakarumuri opened this issue Nov 13, 2024 · 3 comments
Open

Text in scale bar is not adopting to dark mode #967

saratchandrakarumuri opened this issue Nov 13, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@saratchandrakarumuri
Copy link

Text in scale bar is still rendering in white when the device is set to dark mode. Text need to be adopted to display mode

Light mode Dark mode
IMG_0012 IMG_0011
@saratchandrakarumuri saratchandrakarumuri added the bug Something isn't working label Nov 13, 2024
@mhdostal
Copy link
Member

mhdostal commented Nov 13, 2024

@saratchandrakarumuri The scalebar is switching color when switching to Dark Mode. You can see in the "Light mode" image that the text is dark (black). In the "Dark mode" image, the text color has switched to white.

In a true adaptive app the base map would change to a darker color, which would make the white text the appropriate color. As it is now on the very light-colored base map, the white is hard to see.

In the code, the text color is set to .primary, which is an adaptive color. So I don't think there's anything we can do here.

@yo1995
Copy link
Contributor

yo1995 commented Nov 13, 2024

I think the colors in https://github.com/Esri/arcgis-maps-sdk-swift-toolkit/blob/main/Sources/ArcGISToolkit/Components/Scalebar/ScalebarSettings.swift#L60-L70 can be adjusted.

  • If the component is not dark mode adaptive, then all default colors can be hardcoded
  • If it is dark mode adaptive, then all colors should be semantic so they can change automatically

edit: it might be an oddball solution, but maybe the semantic styles can be used: https://developer.apple.com/documentation/swiftui/shapestyle#Semantic-styles

  • benefits: it allows not only semantic styles, but also several translucent materials/styles which work well with both iOS and visionOS.
  • down side: I can see that it would probably make the initializer parameters not read well, as there is no "color" in the words.

@dfeinzimer
Copy link
Collaborator

Since the only semantic colors available are primary and secondary (which equate to either white & lighter gray or black & darker gray) we'd need to use something like @Environment(\.colorScheme) to dynamically pick the appropriate mix of all light and dark mode colors and I haven't found a syntax that's compatible with the current initializer.

Because scalebars are often overlaid directly on maps it seems basemap coloring should actually have more weight on scalebar coloring than light or dark mode. Adapting the scalebar to the color scheme assumes the SDK user is also adapting the basemap to the color scheme. Long term it might be good to look at how we could make the scalebar coloring automatically or more easily adapt to the current basemap coloring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants