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

Custom Theme Creation #65

Open
JoseZamora97 opened this issue Jan 7, 2020 · 0 comments
Open

Custom Theme Creation #65

JoseZamora97 opened this issue Jan 7, 2020 · 0 comments

Comments

@JoseZamora97
Copy link

JoseZamora97 commented Jan 7, 2020

Hi!,
I am trying to create a custom theme from DEFAULT theme but nothing changes.

This is my method that sets the codeview up.

public void setUpCodeView() {

        codeView = findViewById(R.id.code_view);

        int colorAccent = getResources().getColor(R.color.colorAccent);
        int colorPrimary = getResources().getColor(R.color.colorPrimary);

        int colorPrimaryDark = getResources().getColor(R.color.colorPrimaryDark);
        int colorTitles= getResources().getColor(R.color.colorTitles);
        int colorBodies= getResources().getColor(R.color.colorBodies);

        SyntaxColors syntaxColors = new SyntaxColors(
                colorAccent, colorAccent, colorBodies, colorPrimaryDark,
                colorTitles, colorTitles, colorBodies, colorBodies,
                colorTitles, colorTitles, colorBodies
        );

        ColorThemeData myTheme = ColorTheme.DEFAULT.theme()
                .withSyntaxColors(syntaxColors);

        codeView.setOptions(Options.Default.get(this)
                .withTheme(myTheme)
                .withFont(Objects.requireNonNull(ResourcesCompat.getFont(this,
                        R.font.nunito))));
    }

And this is the line where I set code to the codeView

codeView.setCode(myText, "py");

The text appears but there is no code highlight and theme doesnt change.

Ty for help!.

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

1 participant