mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-23 13:14:59 +00:00
feature<Launcher>: change style of tabs in title bar; bookmark color for repository
This commit is contained in:
parent
7e01792a37
commit
a2254ae578
5 changed files with 232 additions and 87 deletions
52
src/Converters/IntToRepoColor.cs
Normal file
52
src/Converters/IntToRepoColor.cs
Normal file
|
@ -0,0 +1,52 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace SourceGit.Converters {
|
||||
|
||||
/// <summary>
|
||||
/// Integer to color.
|
||||
/// </summary>
|
||||
public class IntToRepoColor : IValueConverter {
|
||||
|
||||
/// <summary>
|
||||
/// All supported colors.
|
||||
/// </summary>
|
||||
public static Brush[] Colors = new Brush[] {
|
||||
Brushes.White,
|
||||
Brushes.Red,
|
||||
Brushes.Orange,
|
||||
Brushes.Yellow,
|
||||
Brushes.ForestGreen,
|
||||
Brushes.Purple,
|
||||
Brushes.DeepSkyBlue,
|
||||
Brushes.Magenta,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Implement IValueConverter.Convert
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="targetType"></param>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
return Colors[((int)value) % Colors.Length];
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implement IValueConverter.ConvertBack
|
||||
/// </summary>
|
||||
/// <param name="value"></param>
|
||||
/// <param name="targetType"></param>
|
||||
/// <param name="parameter"></param>
|
||||
/// <param name="culture"></param>
|
||||
/// <returns></returns>
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) {
|
||||
return ((Thickness)value).Left;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue