Skip to content

Commit

Permalink
Update RibbonThemeImageUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
ricaun committed Jul 8, 2024
1 parent 8af5793 commit 7e9c3bf
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Change `GetRibbonItem` to `GetRibbonItem_Alternative` to fix null when panel is removed.
- Update `SetImage` to work with `ComboBoxMember`
- Add `CreateComboBoxMember` to create `ComboBoxMember`.
- Add `RibbonThemeBitmapUtils` to change theme for `BitmapSource`.
- Add `RibbonThemeImageUtils` to change theme for `ImageSource`.
- Update `RibbonThemeImageUtils` with public `GetThemeImageSource`.
- Add `RibbonThemePanelUtils` to update the theme for itens in the `RibbonPanel`.
- Update `RibbonPanel` create and remove to update the theme of the itens.
### Tests
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>0.6.3-beta.2</Version>
<Version>0.6.3-beta.3</Version>
</PropertyGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,24 @@

namespace ricaun.Revit.UI.Utils
{
internal static class RibbonThemeBitmapUtils
/// <summary>
/// RibbonThemeImageUtils
/// </summary>
public static class RibbonThemeImageUtils
{
private const string NAME_DARK = "dark";
private const string NAME_LIGHT = "light";

internal static TImageSource GetThemeImageSource<TImageSource>(this TImageSource imageSource, bool isLight = true) where TImageSource : ImageSource
/// <summary>
/// GetThemeImageSource
/// </summary>
/// <typeparam name="TImageSource"></typeparam>
/// <param name="imageSource"></param>
/// <param name="isLight"></param>
/// <remarks>
/// Replace 'light' to 'dark' or 'dark' to 'light' in the image source name.
/// </remarks>
public static TImageSource GetThemeImageSource<TImageSource>(this TImageSource imageSource, bool isLight = true) where TImageSource : ImageSource
{
if (imageSource.GetSourceName().TryThemeImage(isLight, out string imageTheme))
{
Expand Down

0 comments on commit 7e9c3bf

Please sign in to comment.