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

feat(blocks): impl color picker with signals #7585

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

fundon
Copy link
Contributor

@fundon fundon commented Jul 16, 2024

Closes: BS-610

Add Color Picker for custom colors

Supports

  • note : background
  • frame: background
  • shape: fillColor strokeColor color
  • connector: stroke labelStyle.color
  • text: color
  • brush: color

Features

  • comporents: add color picker for custom colors

    • edgeless-color-picker-button
    • edgeless-color-picker
    • edgeless-color-custom-button
  • models: add CustomColor type for color type

    • e.g. color: string => color: string | CustomColor
    type CustomColor = {
      normal?: string; // #ff00ff00
      light?: string; // #ff00ff00
      dark?: string; // #ff00ff00
    }
  • utils: extand ThemeObserver

    • mode: current theme, light, dark or normal
    • getColor: gets a color without going through computed style
    • getRealColor: gets a real color with going through computed style
  • color fallback rules:

    1. if a color is a CustomColor and includes light and dark fields, automatically take effect according to different themes
    2. if a color is a CustomColor and just includes normal field, consistent colors across themes
    3. if a color is a string and currently only represents a css variable, e.g. --affine-note-background-blue

Copy link

vercel bot commented Jul 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 26, 2024 7:44am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jul 26, 2024 7:44am

Copy link

graphite-app bot commented Jul 16, 2024

Your org has enabled the Graphite merge queue for merging into master

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

Copy link
Contributor Author

fundon commented Jul 16, 2024

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @fundon and the rest of your teammates on Graphite Graphite

@fundon fundon temporarily deployed to Lightweight Test July 16, 2024 01:29 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Lightweight Test July 16, 2024 01:29 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Integration Test July 16, 2024 01:31 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Integration Test July 16, 2024 01:31 — with GitHub Actions Inactive
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Failure
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Inactive
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Failure
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Failure
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Failure
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Failure
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 01:32 — with GitHub Actions Inactive
@fundon fundon force-pushed the 07_16-use-signal-in-color-picker branch from 04a585a to b9b757e Compare July 16, 2024 02:03
@fundon fundon temporarily deployed to Lightweight Test July 16, 2024 02:07 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Lightweight Test July 16, 2024 02:07 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Integration Test July 16, 2024 02:09 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Integration Test July 16, 2024 02:09 — with GitHub Actions Inactive
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 02:10 — with GitHub Actions Failure
@fundon fundon temporarily deployed to Playground E2E Test July 16, 2024 02:10 — with GitHub Actions Inactive
@fundon fundon had a problem deploying to Playground E2E Test July 16, 2024 02:10 — with GitHub Actions Failure
@fundon fundon temporarily deployed to Playground E2E Test July 26, 2024 07:48 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 26, 2024 07:48 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 26, 2024 07:48 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 26, 2024 07:48 — with GitHub Actions Inactive
@fundon fundon temporarily deployed to Playground E2E Test July 26, 2024 07:48 — with GitHub Actions Inactive
@graphite-app graphite-app bot merged commit e0aba03 into master Jul 26, 2024
19 checks passed
@graphite-app graphite-app bot deleted the 07_16-use-signal-in-color-picker branch July 26, 2024 08:00
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 26, 2024 08:08 Inactive
Comment on lines +116 to +117
@yfield()
accessor color: string | CustomColor = '#000000';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change will lead AFFiNE preloading page throw a error. May be there are some legacy data of shape do not contains color

CleanShot 2024-07-26 at 22 19 55@2x

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I will check that.

Copy link
Contributor Author

@fundon fundon Jul 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But it should return #000000.

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

Successfully merging this pull request may close these issues.

4 participants