Skip to content

gezilinll/Lumina

Repository files navigation

Lumina 🌟

A professional, lightweight, and reliable Chrome extension for web highlighting that ensures important information is never lost

δΈ­ζ–‡η‰ˆ | English

Chrome Web Store License Tests

✨ Core Features

πŸ–οΈ Smart Highlighting

  • 4 Colors: Yellow, green, blue, and pink to meet different categorization needs
  • Rich Text Support: Perfectly handles complex formats including cross-node, bold, italic, etc.
  • Instant Feedback: Color toolbar appears immediately after text selection with smooth, natural interaction

πŸ”„ Persistent Storage

  • Auto-Restore: Automatically restores all highlights after page refresh, supports SPA dynamic content
  • Unlimited Storage: Based on Chrome Storage API with no capacity limits
  • Smart Retry: Automatic retry mechanism for dynamically loaded content

🎯 Precise Control

  • Page Rules: Supports three modes: enable all, selective enable, and disable all
  • URL Matching: Flexible allow/block lists for precise highlight control
  • Default Color: Customizable default highlight color

πŸ“Š Efficient Management

  • Tree View: Hierarchical display by domain β†’ path β†’ highlight, clear structure
  • Real-time Search: Quickly locate target highlight content
  • Convenient Operations: Click highlighted text to modify color or delete

πŸš€ Quick Start

Installation

  1. Clone the repository

    git clone https://github.com/yourusername/Lumina.git
    cd Lumina
  2. Load the extension

    • Open Chrome and visit chrome://extensions/
    • Enable "Developer mode" in the top right
    • Click "Load unpacked"
    • Select the project root directory

Usage

Create Highlight

  1. Select text on any webpage
  2. Choose a color from the toolbar that appears
  3. Highlight is immediately applied and automatically saved

Manage Highlights

  • Change Color: Click highlighted text β†’ Select new color
  • Delete Highlight: Click highlighted text β†’ Click delete button
  • View All: Click extension icon to open management panel

Configure Page Rules

  1. Right-click extension icon β†’ Select "Options"
  2. Choose enable mode:
    • All Pages: Enable highlighting on all web pages
    • Selective: Control via allow/block lists
    • Disable All: Turn off highlighting feature
  3. Set default color (optional)

πŸ› οΈ Technical Architecture

Core Algorithm: Segment Wrapping Method

Adopts safe DOM manipulation strategy to ensure stable and reliable highlighting:

1. Traverse all text nodes within the selection range
2. Use splitText() for precise text segmentation
3. Wrap highlighted parts with <span>
4. Multiple spans share the same highlightId

Technical Advantages

  • βœ… Zero DOM Pollution: Does not damage original page structure
  • βœ… Format Preservation: Completely preserves original text format (bold, italic, etc.)
  • βœ… Cross-Node Support: Seamlessly handles rich text scenarios
  • βœ… Reliable Restoration: Smart retry mechanism adapts to dynamic content

Tech Stack

  • Manifest V3: Uses the latest Chrome extension standard
  • Vanilla JavaScript: No external dependencies, lightweight and efficient
  • Chrome Storage API: Local persistent storage
  • Jest + JSDOM: Complete unit and integration tests

πŸ“ Project Structure

Lumina/
β”œβ”€β”€ manifest.json          # Extension configuration
β”œβ”€β”€ background/
β”‚   └── background.js      # Background service script
β”œβ”€β”€ content/
β”‚   β”œβ”€β”€ content.js         # Content script (core logic)
β”‚   └── content.css        # Highlight styles
β”œβ”€β”€ popup/
β”‚   β”œβ”€β”€ popup.html         # Management panel UI
β”‚   β”œβ”€β”€ popup.js          # Management panel logic
β”‚   └── popup.css          # Management panel styles
β”œβ”€β”€ options/
β”‚   β”œβ”€β”€ options.html       # Settings page
β”‚   └── options.js         # Settings logic
β”œβ”€β”€ utils/
β”‚   β”œβ”€β”€ storage.js         # Storage module (Chrome Storage)
β”‚   β”œβ”€β”€ highlight.js       # Highlight core algorithm
β”‚   └── i18n.js            # Internationalization module
β”œβ”€β”€ assets/icons/          # Icon resources
└── tests/                 # Test files
    β”œβ”€β”€ storage.test.js    # Storage module tests
    β”œβ”€β”€ highlight.test.js  # Highlight algorithm tests
    └── integration.test.js # Integration tests

πŸ§ͺ Testing

The project includes comprehensive automated tests to ensure stability:

# Install dependencies
pnpm install

# Run tests
pnpm test

# View coverage
pnpm test:coverage

Test Coverage:

  • βœ… Storage module (URL normalization, CRUD operations, page rules)
  • βœ… Highlight algorithm (create, delete, color change, overlap detection)
  • βœ… Integration flow (select text, create highlight, restore, delete)

🎨 Interface Preview

πŸ’‘ Tip: The actual experience is even better, we recommend installing and trying it

Highlight Toolbar

After selecting text, a color selection toolbar appears at the selected position, supporting quick switching between 4 colors.

Highlight Menu

Click on highlighted text to pop up an action menu for quick color modification or deletion.

Management Panel

Click the extension icon to open a tree-view management panel with search and quick navigation support.

πŸ”§ Configuration Options

Page Rule Modes

  • All Pages (all): Enable highlighting on all web pages
  • Selective (selective): Control via allow/block lists
    • Block list has higher priority than allow list
    • Supports URL prefix matching
  • Disable All (none): Turn off highlighting feature

Default Color

You can select a default highlight color in settings: yellow, green, blue, or pink.

πŸ“ Development Roadmap

  • Core highlighting functionality
  • Rich text support
  • Auto-restore mechanism
  • Page rule configuration
  • Tree view management
  • Search functionality
  • Complete test coverage
  • Internationalization (i18n)
  • Chrome Web Store release
  • Dark theme support
  • Keyboard shortcuts

🀝 Contributing

Issues and Pull Requests are welcome!

πŸ“„ License

MIT License

πŸ™ Acknowledgments

Thanks to all developers who have contributed to this project.


Lumina - Never lose important information ✨

About

A professional, lightweight Chrome extension for web highlighting with rich text support, auto-restore, and smart management

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors