예제 #1
0
        public async Task Color([Remainder] string color = null)
        {
            color = color?.Trim().Replace("#", "");
            if (string.IsNullOrWhiteSpace(color))
            {
                return;
            }
            Rgba32 clr;

            try
            {
                clr = Rgba32.FromHex(color);
            }
            catch
            {
                await ReplyErrorLocalized("hex_invalid").ConfigureAwait(false);

                return;
            }


            var img = new ImageSharp.Image <Rgba32>(50, 50);

            img.BackgroundColor(clr);

            await Context.Channel.SendFileAsync(img.ToStream(), $"{color}.png").ConfigureAwait(false);
        }
예제 #2
0
        public async Task Color([Remainder] string color = null)
        {
            color = color?.Trim().Replace("#", "");
            if (string.IsNullOrWhiteSpace(color))
            {
                return;
            }
            var img = new ImageSharp.Image <Rgba32>(50, 50);

            img.BackgroundColor(ImageSharp.Rgba32.FromHex(color));

            await Context.Channel.SendFileAsync(img.ToStream(), $"{color}.png").ConfigureAwait(false);
        }