highlightjs/highlight.js

(Dart) Highlight colors for Class and Constructor Calls

Open

#4,091 opened on Aug 13, 2024

View on GitHub
 (4 comments) (0 reactions) (0 assignees)JavaScript (22,960 stars) (3,497 forks)batch import
buggood first issuehelp welcomelanguage

Description

Describe the issue

The current output lacks color for class names and constructor calls so most lines are displayed in the same color, which significantly impacts readability and makes it challenging to distinguish between different code components. In contrast

Which language seems to have the issue?

Dart (the issue is impacting Flutter)

Are you using highlight or highlightAuto?

highlight

...

Sample Code to Reproduce


import 'package:flutter/material.dart';

void main() {
  runApp(MaterialApp(
    home: Scaffold (
      appBar: AppBar(
        title: const Text('Scaffold Example'),
      ),
      body: const Center(
        child: Text('Hello, World!'),
      ),
      drawer: Drawer(
        child: ListView(
          children: const <Widget>[
            ListTile(title: Text('Home')),
            ListTile(title: Text('Profile')),
          ],
        ),
      ),
      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(icon: Icon(Icons.home), label: 'Home'),
          BottomNavigationBarItem(icon: Icon(Icons.search), label: 'Search'),
        ],
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () {},
        child: Icon(Icons.add),
      ),
    ),
  ));
}

Expected behavior Highlight colors for Class and Constructor Calls

Additional context

Here are two images: (1) - displaying the current output from the Highlight library , where all elements appear in the same color, making it difficult to read. (2) - a different library, which shows custom colors for classes and constructors. Both images feature code written in Dart for Flutter.

highlight

other

Contributor guide