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

Theming Approach #35

Closed
de-coy opened this issue May 14, 2013 · 13 comments
Closed

Theming Approach #35

de-coy opened this issue May 14, 2013 · 13 comments
Milestone

Comments

@de-coy
Copy link

de-coy commented May 14, 2013

I've been looking at how to approach themes and wondered if you had any thoughts on it so far. I can think of a couple of approaches:

  1. Extend the existing theme approach but allow more flexibility with line colours, fills etc.
  2. Add CSS classes to the individual elements e.g. title, actor, signal, note etc. and use external style sheets to add fill and stroke colours.

My thoughts are that option 1 might become unwieldy as the number of theme options grows larger whereas option 2 keeps a nice separation of concerns. The jQuery initialisation would then look something like this:

$(function() {
    $(".sequence").sequenceDiagram({linestyle: 'hand',themecss:'css/mytheme.css'}); 
});

Any thoughts?

@bramp
Copy link
Owner

bramp commented May 19, 2013

I am all for the CSS approach, however, because I'm using Raphaël this is not possible. Raphaël outputs either SVG or VML (on Internet Explorer). The later doesn't support styling with CSS.

I think the long term solution is for me to drop Raphaël and use a pure SVG solution. I think Raphaël was a poor choice on my part as I keep getting blocked by it.

@bramp bramp mentioned this issue May 19, 2013
@de-coy
Copy link
Author

de-coy commented May 19, 2013

I've started looking to see if there's a way to abstract the drawing
library from the code to make it easier to swap new libraries in and out.
I've not got very far yet but would appreciate your thoughts on this
approach.

On Sunday, May 19, 2013, Andrew Brampton wrote:

I am all for the CSS approach, however, because I'm using Raphaël this is
not possible. Raphaël outputs either SVG or VML (on Internet Explorer). The
later doesn't support styling with CSS.

I think the long term solution is for me to drop Raphaël and use a pure
SVG solution. I think Raphaël was a poor choice on my part as I keep
getting blocked by it.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-18120780
.

dmgcoyle@gmail.com
07718 159 544

@bramp
Copy link
Owner

bramp commented May 19, 2013

I've tried to structure the code to make that possible. For example: HandRaphaëlTheme extends RaphaëlTheme which extends BaseTheme.

You can create a new SomethingTheme that extends BaseTheme. Then all the drawing code can go into the draw_line/draw_rect methods, and it should just work. I don't think there is any Raphael specific code in the BaseTheme.

@de-coy
Copy link
Author

de-coy commented May 20, 2013

Ok, great, I'll take a look.

On Sunday, May 19, 2013, Andrew Brampton wrote:

I've tried to structure the code to make that possible. For example:
HandRaphaëlTheme extends RaphaëlTheme which extends BaseTheme.

You can create a new SomethingTheme that extends BaseTheme. Then all the
drawing code can go into the draw_line/draw_rect methods, and it should
just work. I don't think there is any Raphael specific code in the
BaseTheme.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-18122036
.

dmgcoyle@gmail.com
07718 159 544

@rahulsom
Copy link

+1

@de-coy
Copy link
Author

de-coy commented May 31, 2013

OK, initial version using svg.js is working on a fork.
Current issues:

  • no line styles
  • no arrow heads
  • no css classes

Bramp can you take a look and see if you agree it's on the right track before I push on further?

@bramp
Copy link
Owner

bramp commented May 31, 2013

Awesome, I will look as soon as I can.
On May 31, 2013 5:55 PM, "de-coy" notifications@github.com wrote:

OK, initial version using svg.js is working on a fork.
Current issues:

  • no line styles
  • no arrow heads
  • no css classes

Bramp can you take a look and see if you agree it's on the right track
before I push on further?


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-18773737
.

@bramp
Copy link
Owner

bramp commented Jun 1, 2013

@de-coy I've had a look at what you are doing, and it's certainly on the right track. I think the game plan here is to finish your svg.js version, and then I'll make js-sequence-diagram support both Raphael and svg.js, but make svg.js the default. Then in future we can support CSS styles, etc.

@rahulsom
Copy link

Any idea when this will be merged? Or is @de-coy's branch stable enough to be used in production?

@bramp
Copy link
Owner

bramp commented Aug 27, 2013

@rahulsom based on a quick look at @de-coy code, I think he is still missing some features. As such I don't think his svg.js version is production ready.

@de-coy
Copy link
Author

de-coy commented Aug 27, 2013

It is definitely not suitable for Production and I'm struggling to fit in
any work on it due to family commitments. I'll see if I can fit some time
in over the next couple of weeks...

On Tuesday, August 27, 2013, Andrew Brampton wrote:

@rahulsom https://github.com/rahulsom based on a quick look at @de-coyhttps://github.com/de-coycode, I think he is still missing some features. As such I don't think his
svg.js version is production ready.


Reply to this email directly or view it on GitHubhttps://github.com//issues/35#issuecomment-23352821
.

dmgcoyle@gmail.com
07718 159 544

@benweet
Copy link

benweet commented Apr 24, 2014

Is there a way to access BaseTheme without modifying sequence-diagram.js? Basically I just want to customize the font as RaphaëlTheme does, but outside the lib.

@bramp
Copy link
Owner

bramp commented Feb 20, 2017

Ok since v2.0 we use Snap.svg, which allows styling via CSS! https://github.com/bramp/js-sequence-diagrams#styling

I think this can now be closed.

@bramp bramp closed this as completed Feb 20, 2017
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

4 participants