Skip to content

Custom Theme Creation #65

Description

@JoseZamora97

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!.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions