Enhance ClickableText function to improve hover effects and add color management; update Theme struct to include clickable text colors
This commit is contained in:
@@ -189,13 +189,12 @@ void Paragraph(const std::string& text) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool ClickableText(const std::string& text) {
|
bool ClickableText(const std::string& text) {
|
||||||
|
static auto color = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||||
|
ImGui::TextColored(color, "%s", text.c_str());
|
||||||
if (ImGui::IsItemHovered()) {
|
if (ImGui::IsItemHovered()) {
|
||||||
ImGui::SetMouseCursor(ImGuiMouseCursor_Hand);
|
color = ImGui::GetStyleColorVec4(ImGuiCol_TabHovered);
|
||||||
auto color = ImGui::GetStyleColorVec4(ImGuiCol_TabHovered);
|
|
||||||
ImGui::TextColored(color, "%s", text.c_str());
|
|
||||||
} else {
|
} else {
|
||||||
auto color = ImGui::GetStyleColorVec4(ImGuiCol_Tab);
|
color = ImGui::GetStyleColorVec4(ImGuiCol_Text);
|
||||||
ImGui::TextColored(color, "%s", text.c_str());
|
|
||||||
}
|
}
|
||||||
return ImGui::IsItemClicked();
|
return ImGui::IsItemClicked();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ absl::Status ParseThemeContents(const std::string &key,
|
|||||||
}
|
}
|
||||||
return absl::OkStatus();
|
return absl::OkStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
absl::StatusOr<Theme> LoadTheme(const std::string &filename) {
|
absl::StatusOr<Theme> LoadTheme(const std::string &filename) {
|
||||||
|
|||||||
@@ -33,6 +33,9 @@ struct Theme {
|
|||||||
Color button;
|
Color button;
|
||||||
Color button_hovered;
|
Color button_hovered;
|
||||||
Color button_active;
|
Color button_active;
|
||||||
|
|
||||||
|
Color clickable_text;
|
||||||
|
Color clickable_text_hovered;
|
||||||
};
|
};
|
||||||
|
|
||||||
absl::StatusOr<Theme> LoadTheme(const std::string &filename);
|
absl::StatusOr<Theme> LoadTheme(const std::string &filename);
|
||||||
|
|||||||
Reference in New Issue
Block a user