Skip to content

Modify css access level to public#44

Closed
gewill wants to merge 2 commits intoNuPlay:mainfrom
gewill:main
Closed

Modify css access level to public#44
gewill wants to merge 2 commits intoNuPlay:mainfrom
gewill:main

Conversation

@gewill
Copy link
Copy Markdown

@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
Copy Markdown
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
Copy Markdown
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.

@NuPlay NuPlay mentioned this pull request Aug 24, 2025
10 tasks
@NuPlay NuPlay closed this in #71 Aug 24, 2025
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