Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify css access level to public #44

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Modify css access level to public #44

wants to merge 2 commits into from

Conversation

gewill
Copy link

@gewill gewill commented Jan 17, 2024

Modify the access level of css to public in order to customize the WebView. This change allows users to apply their own styles to the WebView.

Modify the access level of css to public in order to customize the WebView. This change allows users to apply their own styles to the WebView.
@NuPlay
Copy link
Owner

NuPlay commented Jan 21, 2024

I understand that our library already has a customCSS option.
Are you seeking to completely exclude the default provided CSS for a specific purpose? 🤔

Modifying the CSS function alone does not result in a complete change of styles. As shown in the code snippet:

case .auto:
    return """
    <style type='text/css'>
    @media (prefers-color-scheme: light) {
        \(conf.css(isLight: true, alignment: alignment))
    }
    @media (prefers-color-scheme: dark) {
        \(conf.css(isLight: false, alignment: alignment))
    }
    \(conf.customCSS)
    body {
        margin: 0;
        padding: 0;
    }
    </style>
    <BODY>
    """

Additional CSS is applied here.
If you're looking to completely edit the styling, we might need to consider adding an option to accommodate this.

@NuPlay NuPlay added the enhancement New feature or request label Jan 21, 2024
@gewill
Copy link
Author

gewill commented Jan 22, 2024

I understand that our library already has a customCSS option. Are you seeking to completely exclude the default provided CSS for a specific purpose? 🤔

Modifying the CSS function alone does not result in a complete change of styles. As shown in the code snippet:

case .auto:
    return """
    <style type='text/css'>
    @media (prefers-color-scheme: light) {
        \(conf.css(isLight: true, alignment: alignment))
    }
    @media (prefers-color-scheme: dark) {
        \(conf.css(isLight: false, alignment: alignment))
    }
    \(conf.customCSS)
    body {
        margin: 0;
        padding: 0;
    }
    </style>
    <BODY>
    """

Additional CSS is applied here. If you're looking to completely edit the styling, we might need to consider adding an option to accommodate this.

Actually, I used WKNavigationDelegate from WKWebView and needed to customize business requirements, which is why I customized WebView. But I prefer using default css in RichText.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants