コード例 #1
0
        public ColorCollection(ISettings settings)
        {
            var setting = settings.Get <string>("core.colors");

            if (setting != null)
            {
                var customColors = setting.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
                foreach (var c in customColors)
                {
                    var parts = c.Split(new[] { ':' }, StringSplitOptions.RemoveEmptyEntries);
                    colors.Add(parts[0], ColorFormatter.FromHexString(parts[1]));
                }
            }
        }
コード例 #2
0
        private static string ConvertColor(string value, TimetableVersion version)
        {
            var mcolor = ColorFormatter.FromString(value, null);

            return(ColorFormatter.ToString(mcolor, version == TimetableVersion.JTG2_x));
        }
コード例 #3
0
 public string ToName(MColor color)
 => colors.FirstOrDefault(c => c.Value == color).Key ?? ColorFormatter.ToString(color);