Skip to content

Commit b0345ec

Browse files
First version of Prompt for DarkModeRenderer and class scaffolding.
1 parent 5ea89b6 commit b0345ec

File tree

4 files changed

+799
-0
lines changed

4 files changed

+799
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
Create a ButtonDarkModeRenderer class similar to the existing ButtonRenderer in System.Windows.Forms, but specifically designed for dark mode rendering. The class should follow the same architectural patterns as the provided ButtonRenderer while implementing Windows 11 dark mode visual styling.
2+
3+
## Visual Styling Details
4+
5+
### Button Shapes and Corners
6+
1. All buttons should have rounded corners with a radius of approximately 4-5 pixels
7+
2. The corners must be properly anti-aliased
8+
3. For the rounded corners, implement transparency at the very edges so the parent background shows through correctly - this is crucial as the button's rectangular client area includes the corners, but visually they should appear rounded
9+
4. Use alpha blending at the rounded edges to create a smooth transition between the button and its background
10+
11+
### Color Schemes
12+
1. Normal Button (non-default):
13+
- Background: Dark gray (#2B2B2B) when not hovered
14+
- Hover state: Slightly lighter gray (#3B3B3B) - this change should be clearly noticeable
15+
- Pressed state: Even lighter gray (#4B4B4B) with a subtle inward appearance
16+
- Disabled state: Very dark gray (#252525) with reduced opacity text (around 40% opacity)
17+
18+
2. Default Button:
19+
- Background: Accent color (purple tone similar to #6B2FBF when not hovered)
20+
- Hover state: Slightly lighter accent color (#7C3FD0)
21+
- Pressed state: Darker accent color (#5B1FAF) with subtle inward appearance
22+
- Disabled state: Desaturated accent color with reduced opacity text
23+
24+
3. Text Colors:
25+
- Normal state: Light gray (#E0E0E0) for standard buttons, white (#FFFFFF) for default buttons
26+
- Disabled state: Reduced opacity version of normal text color (around 40% opacity)
27+
28+
### Border Styles
29+
1. None border style:
30+
- No visible border, matching Windows 11 dark mode
31+
- Only the fill color and rounded corners are visible
32+
33+
2. Single border style:
34+
- Hair-thin (1px) border with a color that provides sufficient contrast
35+
- For normal buttons: Medium gray (#555555)
36+
- For default buttons: Slightly darker version of the accent color
37+
38+
3. 3D border style:
39+
- Slightly thicker border (1-2px)
40+
- For normal buttons: Top/left slightly lighter (#555555), bottom/right slightly darker (#222222)
41+
- For default buttons: Similar effect but with accent color variations
42+
- On hover: Subtly enhance the contrast between the edges
43+
- On press: Invert the light/dark edges to create an inset appearance
44+
45+
### Focus Indication
46+
1. When a button has focus, draw a 1px dotted outline 2px inside the button's edge
47+
2. The focus indicator should follow the rounded corners
48+
3. For normal buttons: Use a light gray (#AAAAAA) for the focus indicator
49+
4. For default buttons: Use white (#FFFFFF) or very light purple for the focus indicator
50+
5. Ensure the focus indicator doesn't interfere with text or image rendering
51+
52+
### State Transitions
53+
1. All state changes (hover, press, etc.) should have a subtle fade/transition effect if possible
54+
2. The hover and pressed state visual changes should be more pronounced than in the standard renderer
55+
3. Implement a slight scale-down effect (approximately 0.5-1% reduction) when buttons are pressed
56+
57+
## Functional Requirements
58+
59+
1. Maintain complete feature parity with ButtonRenderer:
60+
- Support for text rendering with all the same formatting options
61+
- Support for image rendering with the same positioning options
62+
- Support for combined text and image rendering
63+
- Proper handling of all PushButtonState values
64+
65+
2. Use SystemColors appropriately:
66+
- Rely on the dark mode SystemColors when Application.IsDarkModeEnabled is true
67+
- If specific colors need adjustments beyond SystemColors, implement these within the renderer
68+
69+
3. Transparency and background handling:
70+
- Properly support the IsBackgroundPartiallyTransparent method
71+
- Correctly implement the DrawParentBackground method to handle transparent areas
72+
- Ensure transparent corners are properly rendered showing the parent background
73+
74+
4. Implement all public methods present in ButtonRenderer with identical signatures and parameters
75+
76+
5. Thread safety:
77+
- Maintain the same thread-safety approach as ButtonRenderer with ThreadStatic renderer instances
78+
79+
## Implementation Notes
80+
81+
1. Follow the same pattern as ButtonRenderer, creating a static class with identical method signatures
82+
2. Do not add any additional features beyond what is specified
83+
3. Maintain backward compatibility with existing button rendering behavior
84+
4. Handle fallback for systems where visual styles are not enabled or supported
85+
5. Provide appropriate XML documentation following the same style as the original ButtonRenderer
86+
6. Prioritize rendering performance, especially for the alpha-blended rounded corners
87+
88+
The class should integrate seamlessly with the existing WinForms infrastructure while providing modern Windows 11 dark mode visuals.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Licensed to the .NET Foundation under one or more agreements.
2+
// The .NET Foundation licenses this file to you under the MIT license.
3+
4+
namespace System.Windows.Forms;
5+
6+
/// <summary>
7+
/// Provides methods used to render a button control with or without visual styles.
8+
/// </summary>
9+
internal static class ButtonDarkModeRenderer
10+
{
11+
}

0 commit comments

Comments
 (0)