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

Labels not visible on dark mode #45

Closed
sanskar10100 opened this issue Sep 23, 2022 · 4 comments
Closed

Labels not visible on dark mode #45

sanskar10100 opened this issue Sep 23, 2022 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@sanskar10100
Copy link

Using a LineChart, the x and y-axis labels aren't legible on dark mode since they are in black color. The axis config colors aren't applied to them.

LineChart(
            lineData = minutesReadData,
            color = MaterialTheme.colors.primaryVariant,
            modifier = modifier
                .height(250.dp)
                .fillMaxWidth()
                .padding(vertical = 32.dp, horizontal = 32.dp),
            axisConfig = AxisConfig(
                showAxis = true,
                isAxisDashed = false,
                showUnitLabels = true,
                showXLabels = true,
                xAxisColor = Color.White,
                yAxisColor = Color.White,
            ),
        )

On Light Mode:
image

On Dark Mode:
image

@sanskar10100 sanskar10100 changed the title Labels not visible on darkMode Labels not visible on dark mode Sep 23, 2022
@hi-manshu
Copy link
Owner

Hey this is something I have planned for future releases but right now I am focusing more on making this library stable.. but will keep this in mind!

@sanskar10100
Copy link
Author

Late addition:

As a workaround, I forked the lib and obtained the onSurface color in the LineChart composable:

val labelColor = MaterialTheme.colors.onSurface
yAxis(... labelColor = labelColor)

Then, added a color param to DrawScope.yAxis and DrawScope.drawXLabel which is then consumed during paint object init:

fun draw...(..., labelColor: Color = Color.Black) {
    // ...
    Paint().apply {
        // ...
        color = labelColor.toArgb()
    }
}

Now,
image image

@hi-manshu
Copy link
Owner

Hey, I have these fixed, Will be putting a new release soon!

@hi-manshu hi-manshu added the bug Something isn't working label Oct 4, 2022
@hi-manshu hi-manshu self-assigned this Oct 4, 2022
@hi-manshu
Copy link
Owner

This will be fixed in the next release

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

2 participants