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

how can I set the selection color? how can I change the color? #15

Open
garyliu opened this issue May 28, 2013 · 2 comments
Open

how can I set the selection color? how can I change the color? #15

garyliu opened this issue May 28, 2013 · 2 comments

Comments

@garyliu
Copy link

garyliu commented May 28, 2013

No description provided.

@Neernay
Copy link

Neernay commented Jun 6, 2013

hi..

You can do that through Javascript. I did the same way and its working quiet fine.
Something like this:

JavaScript function:
android.highlight.changeSelectionColor = function (colorCode) {

window.TextSelection.jsLog("JS: changeSelectionColor --> "+colorCode);
$('#selectionColor').text("::selection {background-color: "+colorCode+";}");

};

in HTML, in head TAG something like this:
"<style id="selectionColor"> ::selection{background-color: #98d9f1;} </style>"

Now whenever, you wanna change the color, call the Javascript function through the webview's method:

webview.loadUrl("javascript:android.highlight.changeSelectionColor('#ffff7b')");

See if this works for you.

@garyliu
Copy link
Author

garyliu commented Jan 15, 2014

Thanks

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

No branches or pull requests

2 participants