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

Dark mode #16

Open
ballinger opened this issue May 30, 2024 · 7 comments
Open

Dark mode #16

ballinger opened this issue May 30, 2024 · 7 comments

Comments

@ballinger
Copy link

This is starting to look great! Pls don't forget about dark mode support when you get around the ui part of things. thanx

@ballinger
Copy link
Author

Would be great if multi field values would fetch their color from nocodb. They indicate temperature values in my setup. Not essential but a good visual reminder. thanx! - still using the app daily multiple times :)

@enm10k
Copy link
Owner

enm10k commented Sep 29, 2024

Thank you for the feedback. It is very encouraging.

Would be great if multi field values would fetch their color from nocodb.

Could you tell me which field type you mean?

@ballinger
Copy link
Author

Hey, the field type of the column is a "multi field". I set specific hex codes for my custom entries under details -> fields

@enm10k
Copy link
Owner

enm10k commented Oct 9, 2024

Could you provide more specifics about your use case?
It would also be helpful to see concrete examples of the table structure and columns.

When you mention multi-field, I imagine you're referring to the following feature:
Multi-field editor | NocoDB

As for Multi Select, I’ve already implemented the functionality where the options' colors are reflected in the UI, as shown here:

final color = column.colOptions?.getOptionColor(value);
return Chip(
label: Text(value),
backgroundColor: color,
);

Therefore, I suppose you are referring to multi-field not Multi Select.

@ballinger
Copy link
Author

hi, made you a few screenshots...

When you mention multi-field, I imagine you're referring to the following feature:
Multi-field editor | NocoDB

yes. exacly

Screenshot_20241016-174642
Screenshot_20241016_174217
Screenshot_20241016_174253

@enm10k
Copy link
Owner

enm10k commented Oct 21, 2024

Thank you for sharing the information.

Indeed, the colors displayed in the MultiSelect of nocodb-mobile are incorrect

I realized that the code does not support the case where NocoDB has colors set with 8-digit hex codes, and I suspect this might be the cause of the issue.
I'll try to find time to fix it soon.

// Input: #cccccc or #ccc
// Output: cccccc
String _formatColorCode(String code) {
// #ccc -> #cccccc
if (code.length == 4) {
final (r, g, b) = (code[1], code[2], code[3]);
return '$r$r$g$g$b$b';
}
return code.substring(1);
}
extension NcColOptionsEx on NcColOptions {
Color? getOptionColor(String title) {
final color =
options?.firstWhereOrNull((option) => option.title == title)?.color;
if (color == null) {
return null;
}
final colorCode = _formatColorCode(color);
assert(colorCode.length == 6, colorCode);
return Color(
int.parse('FF$colorCode', radix: 16),
);
}
}

@ballinger
Copy link
Author

Sweet, thanks!

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

No branches or pull requests

2 participants