# Text Styling

## Overview

The Text Styling feature allows developers to customize the color of the URL text in both its normal state and when hovered by the mouse. This enables the integration of the control with different themes and ensures that the text remains legible and visually appealing in various UI designs.

***

### Key Points

<table><thead><tr><th width="154">Item</th><th>Description</th><th>Example / Notes</th></tr></thead><tbody><tr><td>UrlColor</td><td>Defines the color of the URL text in its normal, unhovered state.</td><td>Example: <code>copyUrlControl.UrlColor = Color.Black;</code></td></tr><tr><td>UrlHoverColor</td><td>Specifies the color of the URL text when a user hovers the mouse over it.</td><td>Example: <code>copyUrlControl.UrlHoverColor = Color.Blue;</code></td></tr></tbody></table>

***

### Code Samples

#### Setting Default and Hover Text Colors

Below is an example demonstrating how to set up the URL text color and hover color for the control:

```csharp
// Create an instance of the control
SiticoneCopyUrl copyUrlControl = new SiticoneCopyUrl
{
    // Set the URL for display
    Url = "https://www.example.com",
    
    // Configure text styling
    UrlColor = Color.Black,          // Default text color
    UrlHoverColor = Color.Blue       // Text color when hovered
};

// Add the control to the form
this.Controls.Add(copyUrlControl);
```

#### Dynamically Changing Text Styling at Runtime

This example shows how to update the text styling based on runtime conditions, such as switching themes:

```csharp
// Assuming copyUrlControl is already added to the form
private void UpdateTextStyling(bool isDarkTheme)
{
    if (isDarkTheme)
    {
        copyUrlControl.UrlColor = Color.LightGray;
        copyUrlControl.UrlHoverColor = Color.Cyan;
    }
    else
    {
        copyUrlControl.UrlColor = Color.Black;
        copyUrlControl.UrlHoverColor = Color.Blue;
    }
}
```

#### Full Integration Example with a Form

Integrate the text styling settings into a Windows Form application:

```csharp
public partial class MainForm : Form
{
    public MainForm()
    {
        InitializeComponent();
        InitializeCopyUrlControl();
    }

    private void InitializeCopyUrlControl()
    {
        SiticoneCopyUrl copyUrlControl = new SiticoneCopyUrl
        {
            Location = new Point(20, 20),
            Size = new Size(300, 40),
            Url = "https://www.example.com",
            // Text Styling settings
            UrlColor = Color.Black,
            UrlHoverColor = Color.Blue
        };

        this.Controls.Add(copyUrlControl);
    }
}
```

***

### Best Practices

<table><thead><tr><th width="243">Practice</th><th>Description</th><th>Example / Notes</th></tr></thead><tbody><tr><td>Consistent Color Schemes</td><td>Choose text colors that complement the overall application theme and provide sufficient contrast.</td><td>Use colors that align with your application's palette, e.g., dark text on light backgrounds.</td></tr><tr><td>Test Hover States</td><td>Ensure that the hover color is visually distinct yet harmonious with the default text color.</td><td>Verify that the change from UrlColor to UrlHoverColor is smooth and noticeable.</td></tr><tr><td>Maintain Readability</td><td>Avoid using colors that may reduce the legibility of the URL text, especially on varied background styles.</td><td>Test with different background fill modes (solid and gradient).</td></tr></tbody></table>

***

### Common Pitfalls

| Pitfall                    | Description                                                                                                     | How to Avoid                                                                         |
| -------------------------- | --------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| Poor Contrast              | Using text colors that lack sufficient contrast with the background may hinder readability.                     | Choose colors with high contrast and test under different lighting conditions.       |
| Inconsistent Hover Effects | Neglecting to set a distinct hover color can lead to a static experience with no visual feedback.               | Always configure both UrlColor and UrlHoverColor to provide clear feedback.          |
| Overriding System Defaults | Over-customizing text styles without considering default system themes might lead to a jarring user experience. | Ensure that custom colors enhance, rather than conflict with, existing UI standards. |

***

### Usage Scenarios

| Scenario                    | Description                                                                       | Example / Notes                                           |
| --------------------------- | --------------------------------------------------------------------------------- | --------------------------------------------------------- |
| Themed Applications         | Integrate text styling that matches the application's light or dark themes.       | Set UrlColor and UrlHoverColor based on the active theme. |
| Responsive UI Designs       | Adjust text styling to ensure legibility on various screen sizes and resolutions. | Test text colors on both high-DPI and standard displays.  |
| Interactive User Interfaces | Use hover color effects to provide immediate feedback, enhancing user engagement. | Apply a subtle yet noticeable change for hover states.    |

***

### Real Life Usage Scenarios

<table><thead><tr><th width="221">Scenario</th><th>Description</th><th>Example / Notes</th></tr></thead><tbody><tr><td>Corporate Portals</td><td>Use conservative text styling (e.g., black on white) for professional and easy-to-read interfaces.</td><td>UrlColor = Color.Black; UrlHoverColor = Color.Blue;</td></tr><tr><td>Consumer-Facing Apps</td><td>Apply vibrant colors to capture user attention and improve interactivity on public-facing platforms.</td><td>Consider using a brighter hover color for immediate visual feedback.</td></tr><tr><td>Mobile Applications</td><td>Ensure that text styling is adaptable to different screen resolutions and provides high readability.</td><td>Test on both smartphones and tablets for consistency.</td></tr></tbody></table>

***

### Troubleshooting Tips

<table><thead><tr><th width="221">Tip</th><th>Description</th><th>Example / Notes</th></tr></thead><tbody><tr><td>Verify Property Assignments</td><td>Ensure that both UrlColor and UrlHoverColor properties are correctly assigned.</td><td>Use debugging logs to confirm property values during runtime.</td></tr><tr><td>Test in Multiple Themes</td><td>Check text styling in both light and dark modes to ensure consistent readability.</td><td>Switch themes at runtime and observe the text color changes.</td></tr><tr><td>Validate Against Backgrounds</td><td>Make sure the selected text colors provide sufficient contrast against different background fill modes.</td><td>Test with both solid and gradient backgrounds.</td></tr></tbody></table>

***

### Review

<table><thead><tr><th width="216">Aspect</th><th>Feedback</th><th>Example / Notes</th></tr></thead><tbody><tr><td>Visual Consistency</td><td>Text styling ensures that URL text integrates well with different design themes while remaining legible.</td><td>Consistent application of UrlColor and UrlHoverColor.</td></tr><tr><td>User Interaction</td><td>The hover effect enhances interactivity by providing visual feedback when the URL text is engaged.</td><td>A noticeable change in color when hovering over the URL text.</td></tr><tr><td>Ease of Customization</td><td>Simple property assignments allow developers to quickly adjust text styling to match their application’s needs.</td><td>Minimal code changes are required to update the text appearance.</td></tr></tbody></table>

***

### Summary

<table><thead><tr><th width="235">Summary Aspect</th><th>Details</th><th>Example / Notes</th></tr></thead><tbody><tr><td>Customizable Text Colors</td><td>Developers can control the URL text appearance by setting default and hover colors to match any UI design.</td><td>Use UrlColor for default state and UrlHoverColor for mouse hover state.</td></tr><tr><td>Enhanced User Feedback</td><td>The visual change on hover provides immediate feedback, improving overall user interaction with the control.</td><td>A subtle yet effective color transition enhances usability.</td></tr><tr><td>Simple Integration</td><td>Integration is straightforward with clear property settings and minimal code, enabling quick deployment in any WinForms app.</td><td>Integration examples demonstrate easy setup and dynamic adjustments.</td></tr></tbody></table>

***

### Additional Sections

#### Integration Checklist

| Checklist Item              | Description                                                                                | Example / Notes                                 |
| --------------------------- | ------------------------------------------------------------------------------------------ | ----------------------------------------------- |
| Set UrlColor                | Ensure the default text color is set to a color that complements the control’s background. | `copyUrlControl.UrlColor = Color.Black;`        |
| Configure UrlHoverColor     | Define a hover color that provides clear visual feedback on user interaction.              | `copyUrlControl.UrlHoverColor = Color.Blue;`    |
| Test on Various Backgrounds | Validate that the text remains legible on both solid and gradient backgrounds.             | Test under different UI themes and resolutions. |

#### Additional Considerations

| Consideration               | Description                                                                                               | Example / Notes                                              |
| --------------------------- | --------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
| Dynamic Theme Switching     | Consider updating text colors dynamically when the application theme changes.                             | Update properties in theme change event handlers.            |
| Consistency Across Controls | Ensure that text styling is consistent with other textual elements in the application for a unified look. | Align URL text styling with other controls’ text properties. |

***

### Final Notes

The Text Styling feature of the SiticoneCopyUrl control offers robust customization options for the URL text display, ensuring that it is both legible and attractive in various UI contexts. By following the best practices and examples provided in this documentation, developers can effortlessly integrate and adjust text styling to suit their application’s design needs while maintaining a consistent and engaging user experience.
